def test_init_things(self): with FileTester.temp_input(testdata) as tempfilename: ledgerfile = LedgerFile(tempfilename, 'cash') recon = Reconciler(ledgerfile) self.verify_equal_floats(-15, recon.total_cleared) self.verify_equal_floats(-32.12, recon.total_pending) payees = { thing.payee for thing in recon.open_transactions } # all open transactions, including the future: self.assertEqual( ({'two', 'two pt five', 'three', 'four'}), payees ) payees = { thing.payee for k, thing in recon.current_listing.iteritems() } # future items included only if pending ('three') self.assertEqual( ({'two', 'two pt five', 'three'}), payees ) self.assertEqual(date.today(), recon.ending_date) self.assertIsNone(recon.ending_balance) self.assertEqual(3, len(recon.current_listing)) self.assertEqual( 'a: cash', ledgerfile.get_reconciliation_account() )
def test_parsed_file_unchanged_via_print(self): """file output after parsing should be identical to input""" expected = FileTester.read_file(FileTester.testfile) ledgerfile = LedgerFile(FileTester.testfile) ledgerfile.print_file() self.redirect.seek(0) self.assertEqual(expected, self.redirect.read()) self.assertIsNone(ledgerfile.get_reconciliation_account())