示例#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())
示例#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)
示例#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}'))
示例#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)
示例#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)
示例#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}'))
示例#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())