コード例 #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)