def __init__(self, cost_in_euro, payer, participants): self.cost_in_cents = utils.parse_amount(cost_in_euro) self.payer = payer self.participants = participants self.balancing_operation = False self.date = time.localtime() self.remainder_person = ""
def test_error_comma(self): with self.assertRaises(u.ConversionError): u.parse_amount("3,troll") with self.assertRaises(u.ConversionError): u.parse_amount("3,tr") with self.assertRaises(u.ConversionError): u.parse_amount("3,333")
def test_error_dot(self): with self.assertRaises(u.ConversionError): u.parse_amount("3.troll") with self.assertRaises(u.ConversionError): u.parse_amount("3.tr") with self.assertRaises(u.ConversionError): u.parse_amount("3.333")
def test_simple_dot(self): self.assertEqual(u.parse_amount("3.6"), 360) self.assertEqual(u.parse_amount("3.60"), 360) self.assertEqual(u.parse_amount("3."), 300)
def test_error(self): with self.assertRaises(u.ConversionError): u.parse_amount("troll")
def test_without_delim(self): self.assertEqual(u.parse_amount("3"), 300)
def test_simple_comma(self): self.assertEqual(u.parse_amount("3,6"), 360) self.assertEqual(u.parse_amount("3,60"), 360) self.assertEqual(u.parse_amount("3,"), 300)
def __init__(self, amount_in_euro, source, destination): self.amount_in_cents = utils.parse_amount(amount_in_euro) self.source = source self.destination = destination self.date = time.localtime()