Example #1
0
 def test_default(self):
     self.assertEqual(get_int('1a', 9), 9)
     self.assertEqual(get_int('1a'), None)
     self.assertEqual(get_int(' 123    '), 123)
     self.assertEqual(get_int(' -123    '), -123)
     self.assertEqual(get_int(123), 123)
     self.assertEqual(get_int('0'), 0)
     self.assertEqual(get_int(0b10), 2)
Example #2
0
 def test_other(self):
     self.assertEqual(get_int(None, sep=','), [])
     self.assertEqual(get_int(None, 0), 0)
Example #3
0
 def test_error(self):
     self.assertEqual(get_int('a123, 4.56,, x,, ,', sep=','), [])
Example #4
0
 def test_int_list(self):
     self.assertEqual(get_int('123, 456,, 7,, ,', default=9, sep=','), [123, 456, 7])
     self.assertEqual(get_int('123, 456,, 7,, ,', sep=','), [123, 456, 7])