def test_yaml(self): str_entry = StringConfigEntry(key_path=["testing", "key1"], default="value") int_entry = IntConfigEntry(key_path=["testing", "key2"], default=2) source = YamlSource("test") source.load() self.assertTrue(source.has(str_entry)) self.assertEqual(source.get(str_entry), "value") self.assertTrue(source.has(int_entry)) self.assertEqual(source.get(int_entry), 2)
def test_ignore_case(self): str_entry1 = StringConfigEntry( key_path=["tHiS", "Is", "CaseInsensitive"], default="value") str_entry2 = StringConfigEntry( key_path=["This", "is", "caseinsensitive"], default="value") str_entry3 = StringConfigEntry(key_path=["this", "or", "iSit"], default="value") source = YamlSource("case_insensitive", ["./", "./tests"], ignore_case_in_keys=True) source.load() self.assertTrue(source.has(str_entry1)) self.assertEqual(source.get(str_entry1), "value") self.assertTrue(source.has(str_entry2)) self.assertEqual(source.get(str_entry2), "value") self.assertTrue(source.has(str_entry3)) self.assertEqual(source.get(str_entry3), "?")