コード例 #1
0
 def test_get_nested_does_not_exist(self):
     info = {"dataCenterInfo": {"name": "MyOwn"}}
     instance = Instance(info)
     with self.assertRaises(KeyError):
         instance.get("dataCenterInfo.name.data")
コード例 #2
0
 def test_get_does_not_exist(self):
     instance = Instance({})
     with self.assertRaises(KeyError):
         instance.get("hostName")
コード例 #3
0
 def test_get_nested(self):
     info = {"dataCenterInfo": {"name": "MyOwn"}}
     instance = Instance(info)
     self.assertEqual("MyOwn", instance.get("dataCenterInfo.name"))
コード例 #4
0
 def test_get(self):
     info = {"hostName": "example.com"}
     instance = Instance(info)
     self.assertEqual("example.com", instance.get('hostName'))