def test_check_value_none_found(self): f = ConfigFile() with self.assertRaises(ConfigFile.UnexpectedKeyValueError) as err: f.check_value("invalid", "value") self.assertEqual(str(err.exception), "Expected to have invalid='value', but none was found.")
def test_check_value_from_json(self): f = ConfigFile('{"key":"value"}') f.check_value("key", "value")
def test_check_value_invalid(self): f = ConfigFile({"key": "value"}) with self.assertRaises(ConfigFile.UnexpectedKeyValueError) as err: f.check_value("key", "invalid") self.assertEqual(str(err.exception), "Expected to have key='invalid', but was 'value'.")
def test_check_value(self): f = ConfigFile({"key": "value"}) f.check_value("key", "value")