Пример #1
0
 def test_both_subdicts(self):
     setting_types = {
         'automatic': {
             'test1auto': None
         },
         'manual': {
             'test2manual': None
         }
     }
     with self.subTest(i=0, msg='Testing automatic subdict'):
         self.assertEqual(valid_setting('test1auto', '', setting_types), True)
     with self.subTest(i=1, msg='Testing manual subdict'):
         self.assertEqual(valid_setting('test2manual', '', setting_types), True)
Пример #2
0
 def test_empty_manual(self):
     setting_types = {
         'automatic': {
             'test': None
         },
         'manual': {}
     }
     self.assertEqual(valid_setting('test', '', setting_types), True)
Пример #3
0
 def test_notype(self):
     self.assertEqual(valid_setting('testnope', 'Haha', self.setting_types), True)
Пример #4
0
 def test_invalid_float(self):
     self.assertEqual(valid_setting('testfloat', 12, self.setting_types), False)
Пример #5
0
 def test_valid_float(self):
     self.assertEqual(valid_setting('testfloat', 12.3, self.setting_types), True)
Пример #6
0
 def test_invalid_int(self):
     self.assertEqual(valid_setting('testint', 'no', self.setting_types), False)
Пример #7
0
 def test_valid_int(self):
     self.assertEqual(valid_setting('testint', 189, self.setting_types), True)
Пример #8
0
 def test_invalid_bool(self):
     self.assertEqual(valid_setting('testbool', 'true', self.setting_types), False)
Пример #9
0
 def test_valid_bool(self):
     self.assertEqual(valid_setting('testbool', True, self.setting_types), True)