Ejemplo n.º 1
0
 def test_add_account(self):
     gl = Ledger()
     gl.add_account(create_account('cash'))
     gl.add_account(
         create_account('retained earnings',
                        NormalBalance.CR,
                        balance=123.45))
     gl.add_account(create_account('property taxes payable', 'CR', 51.23))
Ejemplo n.º 2
0
 def test_DR_CR(self):
     a = create_account('retained earnings',
                        NormalBalance.CR,
                        balance=123.45)
     self.assertEqual(a.balance, 123.45)
     self.assertEqual(a.value, -123.45)
     a = create_account('cash', balance=123.45)
     self.assertEqual(a.value, 123.45)
     a = Account('equity', 'CR', balance=123.45)
     self.assertEqual(a.balance, 123.45)
     self.assertEqual(a.value, -123.45)
Ejemplo n.º 3
0
 def setUp(self):
     gl = Ledger()
     gl.add_account(create_account('cash', balance=60))
     gl.add_account(create_account('accounts payable', 'CR', 200))
     gl.add_account(create_account('accounts receivable', balance=300))
     gl.add_account(
         create_account('owners equity', NormalBalance.CR, balance=50))
     gl.add_account(create_account('property taxes payable', 'CR', 190))
     gl.add_account(create_account('retained earnings', 'CR', balance=40))
     gl.add_account(create_account('inventory', balance=120))
     self.assertEqual(gl.balance, 0)
     self.gl = gl
Ejemplo n.º 4
0
 def test_balance(self):
     gl = Ledger()
     gl.add_account(create_account('cash'))
     self.assertEqual(gl.balance, 0)
     gl.add_account(create_account('accounts payable', 'CR', 12.34))
     self.assertEqual(gl.balance, -12.34)
     gl.add_account(create_account('accounts receivable', balance=12.34))
     self.assertEqual(gl.balance, 0)
     gl.add_account(
         create_account('owners equity', NormalBalance.CR, balance=123.45))
     self.assertEqual(gl.balance, -123.45)
     gl.add_account(create_account('property taxes payable', 'CR', 51.23))
     self.assertEqual(gl.balance, -123.45 - 51.23)
     gl.add_account(create_account('retained earnings', 'CR',
                                   balance=12.34))
     self.assertEqual(gl.balance, -187.02)
     gl.add_account(create_account('inventory', balance=187.02))
     self.assertEqual(gl.balance, 0)
Ejemplo n.º 5
0
 def test_repr(self):
     a = create_account('cash', NormalBalance.DR, balance=123.45)
     self.assertEqual(repr(a), '<Account cash DR balance 123.45>')
     a = create_account('cash')
     self.assertEqual(repr(a), '<Account cash DR balance 0>')