def test_get_nested_does_not_exist(self): info = {"dataCenterInfo": {"name": "MyOwn"}} instance = Instance(info) with self.assertRaises(KeyError): instance.get("dataCenterInfo.name.data")
def test_get_does_not_exist(self): instance = Instance({}) with self.assertRaises(KeyError): instance.get("hostName")
def test_get_nested(self): info = {"dataCenterInfo": {"name": "MyOwn"}} instance = Instance(info) self.assertEqual("MyOwn", instance.get("dataCenterInfo.name"))
def test_get(self): info = {"hostName": "example.com"} instance = Instance(info) self.assertEqual("example.com", instance.get('hostName'))