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