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)
def test_empty_manual(self): setting_types = { 'automatic': { 'test': None }, 'manual': {} } self.assertEqual(valid_setting('test', '', setting_types), True)
def test_notype(self): self.assertEqual(valid_setting('testnope', 'Haha', self.setting_types), True)
def test_invalid_float(self): self.assertEqual(valid_setting('testfloat', 12, self.setting_types), False)
def test_valid_float(self): self.assertEqual(valid_setting('testfloat', 12.3, self.setting_types), True)
def test_invalid_int(self): self.assertEqual(valid_setting('testint', 'no', self.setting_types), False)
def test_valid_int(self): self.assertEqual(valid_setting('testint', 189, self.setting_types), True)
def test_invalid_bool(self): self.assertEqual(valid_setting('testbool', 'true', self.setting_types), False)
def test_valid_bool(self): self.assertEqual(valid_setting('testbool', True, self.setting_types), True)