Exemple #1
0
    def test_simple_negative_lots(self, entries, errors, options_map):
        """
          2013-05-01 open Assets:Bank:Investing
          2013-05-01 open Equity:Opening-Balances

          2013-05-02 *
            Assets:Bank:Investing                -1 HOOL {501 USD}
            Equity:Opening-Balances             501 USD
        """
        validation_errors = booking.validate_inventory_booking(
            entries, options_map)
        self.assertEqual([], list(map(type, validation_errors)))
Exemple #2
0
    def test_mixed_lots_in_single_transaction(self, entries, errors,
                                              options_map):
        """
          2013-05-01 open Assets:Bank:Investing
          2013-05-01 open Equity:Opening-Balances

          2013-05-02 *
            Assets:Bank:Investing                 5 HOOL {501 USD}
            Assets:Bank:Investing                -1 HOOL {502 USD}
            Equity:Opening-Balances           -2003 USD
        """
        validation_errors = booking.validate_inventory_booking(
            entries, options_map)
        self.assertEqual([booking.BookingError],
                         list(map(type, validation_errors)))
Exemple #3
0
 def convert_and_validate(self, entries, options_map):
     entries, _ = convert_lot_specs_to_lots(entries)
     return booking.validate_inventory_booking(entries, options_map,
                                               self.BOOKMETH)
Exemple #4
0
 def do_validate_inventory_booking(self, input_str):
     entries, errors, options_map = parser.parse_string(input_str)
     validation_errors = booking.validate_inventory_booking(
         entries, options_map)
     self.assertEqual([], list(map(type, validation_errors)))