Ejemplo n.º 1
0
 def test_reducing__sans_date__equal_amount(self):
     inv = inventory.Inventory()
     wash_calculator.book_position(
         inv, DD('2014-02-10'), position.from_string('10 HOOL {500 USD}'))
     wash_calculator.book_position(
         inv, DD('2014-02-10'), position.from_string('-10 HOOL {500 USD}'))
     self.assertTrue(inv.is_empty())
Ejemplo n.º 2
0
 def test_creating__with_date(self):
     inv = inventory.Inventory()
     wash_calculator.book_position(
         inv, DD('2014-02-10'),
         position.from_string('10 HOOL {500 USD / 2014-02-11}'))
     self.assertEqual(
         inventory.from_string('10 HOOL {500 USD / 2014-02-11}'), inv)
Ejemplo n.º 3
0
 def test_reducing__sans_date__over_amount(self):
     inv = inventory.Inventory()
     wash_calculator.book_position(
         inv, DD('2014-02-10'), position.from_string('10 HOOL {500 USD}'))
     with self.assertRaises(ValueError):
         wash_calculator.book_position(
             inv, DD('2014-02-10'),
             position.from_string('-13 HOOL {500 USD}'))
Ejemplo n.º 4
0
 def test_reducing__sans_date__incomplete_amount(self):
     inv = inventory.Inventory()
     wash_calculator.book_position(
         inv, DD('2014-02-10'), position.from_string('10 HOOL {500 USD}'))
     wash_calculator.book_position(
         inv, DD('2014-02-10'), position.from_string('-7 HOOL {500 USD}'))
     self.assertEqual(
         inventory.from_string('3 HOOL {500 USD / 2014-02-10}'), inv)
Ejemplo n.º 5
0
 def test_augmenting__sans_date(self):
     inv = inventory.Inventory()
     wash_calculator.book_position(
         inv, DD('2014-02-10'), position.from_string('10 HOOL {500 USD}'))
     wash_calculator.book_position(inv, DD('2014-02-10'),
                                   position.from_string('7 HOOL {500 USD}'))
     self.assertEqual(
         inventory.from_string('17 HOOL {500 USD / 2014-02-10}'), inv)
Ejemplo n.º 6
0
 def test_reducing__with_diff_date__incomplete_amount(self):
     inv = inventory.Inventory()
     wash_calculator.book_position(
         inv, DD('2014-02-10'), position.from_string('10 HOOL {500 USD}'))
     with self.assertRaises(ValueError):
         wash_calculator.book_position(
             inv, DD('2014-02-10'),
             position.from_string('-7 HOOL {500 USD / 2014-02-11}'))
Ejemplo n.º 7
0
 def test_empty(self):
     inv = inventory.Inventory()
     wash_calculator.book_position(inv, DD('2014-02-03'),
                                   position.from_string('0 HOOL {500 USD}'))
     self.assertTrue(inv.is_empty())