def test_no_decimal(self): text = 'S$ 10' * 2 with self.assertRaises(AssertionError): get_balance_from_text(text)
def test_return_type(self): text = 'S$ 0.00' * 2 result = get_balance_from_text(text) self.assertEqual(type(result), float)
def test_one_match(self): text = 'S$ 0.00' with self.assertRaises(AssertionError): get_balance_from_text(text)
def test_empty_string(self): text = '' with self.assertRaises(AssertionError): get_balance_from_text(text)
def test_less_than_billion(self): text = 'S$ 999,999,999.99' * 2 self.assertEqual(get_balance_from_text(text), 999_999_999.99)
def test_less_than_thousand(self): text = 'S$ 999.999' * 2 self.assertEqual(get_balance_from_text(text), 999.99)
def test_zero(self): text = 'S$ 0.00' * 2 self.assertEqual(get_balance_from_text(text), 0)