Example #1
0
 def test_bool(self):
     trues = ['y', '1', 'true', 'Y', 'True', 'TRUE']
     falses = ['n', '0', 'false', 'N', 'False', 'FALSE']
     l = [(x, True) for x in trues] + [(x, False) for x in falses]
     for n, x in enumerate(l):
         with self.subTest(i=n):
             self.assertEqual(parse_terminal_setting(x[0], bool), x[1])
Example #2
0
 def test_no_type(self):
     l = ['10.0', 'arst', 'jinz tai lorem ipsum']
     for n, x in enumerate(l):
         with self.subTest(i=n):
             self.assertEqual(parse_terminal_setting(x, None), x)
Example #3
0
 def test_invalid_float(self):
     l = ['x', 'blooop']
     for n, x in enumerate(l):
         with self.subTest(i=n):
             self.assertIsNone(parse_terminal_setting(x, float))
Example #4
0
 def test_float(self):
     l = ['10.0', '1298', '-0.50', '-99.9']
     for n, x in enumerate(l):
         with self.subTest(i=n):
             self.assertEqual(parse_terminal_setting(x, float), float(x))
Example #5
0
 def test_invalid_int(self):
     l = ['10.1', 'x', '-0.05', 'blooop']
     for n, x in enumerate(l):
         with self.subTest(i=n):
             self.assertIsNone(parse_terminal_setting(x, int))
Example #6
0
 def test_int(self):
     l = ['10', '1298', '-50']
     for n, x in enumerate(l):
         with self.subTest(i=n):
             self.assertEqual(parse_terminal_setting(x, int), int(x))
Example #7
0
 def test_invalid_bool(self):
     l = ['no', 'yes', 'x', '10']
     for n, x in enumerate(l):
         with self.subTest(i=n):
             self.assertIsNone(parse_terminal_setting(x, bool))