<commit_before>from django.test import TestCase
from casexml.apps.stock.consumption import ConsumptionConfiguration, compute_consumption_from_transactions
from casexml.apps.stock.tests.mock_consumption import mock_consumption as consumption, mock_transaction as _tx, now


class ConsumptionCalcTest(TestCase):

    def test_one_period(self):
        self.assertAlmostEqual(consumption([
                _tx('stockonhand', 25, 5),
                _tx('stockonhand', 25, 0),
            ], 60), 0.)
        self.assertAlmostEqual(consumption([
                _tx('stockonhand', 25, 5),
                _tx('receipts', 10, 0),
                _tx('stockonhand', 35, 0),
            ], 60), 0.)
        # 15 / 5 = 3
        self.assertAlmostEqual(consumption([
                _tx('stockonhand', 25, 5),
                _tx('consumption', 15, 0),
                _tx('stockonhand', 10, 0),
            ], 60), 3.)
        # 27 / 5 = 5.4
        self.assertAlmostEqual(consumption([
                _tx('stockonhand', 25, 5),
                _tx('receipts', 12, 3),
                _tx('consumption', 27, 0),
                _tx('stockonhand', 10, 0),
            ], 60), 5.4)
        # (6 + 21) / 5 = 5.4
        self.assertAlmostEqual(consumption([<commit_msg>make stock test simple test<commit_after>from django.test import SimpleTestCase
from casexml.apps.stock.tests.mock_consumption import mock_consumption as consumption, mock_transaction as _tx


class ConsumptionCalcTest(SimpleTestCase):

    def test_one_period(self):
        self.assertAlmostEqual(consumption([
                _tx('stockonhand', 25, 5),
                _tx('stockonhand', 25, 0),
            ], 60), 0.)
        self.assertAlmostEqual(consumption([
                _tx('stockonhand', 25, 5),
                _tx('receipts', 10, 0),
                _tx('stockonhand', 35, 0),
            ], 60), 0.)
        # 15 / 5 = 3
        self.assertAlmostEqual(consumption([
                _tx('stockonhand', 25, 5),
                _tx('consumption', 15, 0),
                _tx('stockonhand', 10, 0),
            ], 60), 3.)
        # 27 / 5 = 5.4
        self.assertAlmostEqual(consumption([
                _tx('stockonhand', 25, 5),
                _tx('receipts', 12, 3),
                _tx('consumption', 27, 0),
                _tx('stockonhand', 10, 0),
            ], 60), 5.4)
        # (6 + 21) / 5 = 5.4
        self.assertAlmostEqual(consumption([
{'fraction_non_alphanumeric': 0.13127572016460906, 'fraction_numerical': 0.05267489711934156, 'mean_word_length': 1.8532863849765258, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 3}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '364853', 'n_tokens_mistral': 872, 'n_tokens_neox': 706, 'n_words': 161}