Exemplo n.º 1
0
 def test_updates_normal_recursive_dicts(self):
     sys_dict = SystemDict()
     sys_dict["name"] = {"value": "ELT"}
     sys_dict.update({"name": {"type": "str"}})
     assert sys_dict["name"]["value"] == "ELT"
     assert sys_dict["name"]["type"] == "str"
Exemplo n.º 2
0
 def test_updates_yaml_alias_recursive_dicts(self, basic_yaml):
     sys_dict = SystemDict(copy.deepcopy(basic_yaml))
     basic_yaml["properties"] = {"temperature": 42, "humidity": 0.75}
     sys_dict.update(basic_yaml)
     assert sys_dict["!OBS.temperature"] == 42
     assert sys_dict["OBS"]["humidity"] == 0.75
Exemplo n.º 3
0
 def test_uses___contains___keyword_for_normal_dicts(self):
     sys_dict = SystemDict({"name": "ELT"})
     assert "name" in sys_dict
Exemplo n.º 4
0
 def test_uses___contains___keyword_for_special_dicts(self, basic_yaml):
     sys_dict = SystemDict(basic_yaml)
     assert "!OBS.temperature" in sys_dict
     assert "!OBS.temperature.unit" not in sys_dict
     assert "!OBS.humidity" not in sys_dict
Exemplo n.º 5
0
 def test_can_and_and_retrieve_special_dict_entries(self, basic_yaml):
     sys_dict = SystemDict(basic_yaml)
     sys_dict["!OBS.lam.max.unit"] = "um"
     print(sys_dict)
     assert sys_dict["!OBS.lam.max.unit"] == "um"
     assert sys_dict["!OBS.temperature"] == 100
Exemplo n.º 6
0
 def test_can_add_and_retrieve_normal_dict_entries(self):
     sys_dict = SystemDict()
     sys_dict["name"] = "ELT"
     assert sys_dict["name"] == "ELT"
Exemplo n.º 7
0
 def test_initalises_with_yaml_dict(self, basic_yaml):
     sys_dict = SystemDict(basic_yaml)
     assert isinstance(sys_dict, SystemDict)
     assert "OBS" in sys_dict.dic
Exemplo n.º 8
0
 def test_initalises_with_normal_dict(self):
     sys_dict = SystemDict({"a": 1})
     assert isinstance(sys_dict, SystemDict)
Exemplo n.º 9
0
 def test_initialises_with_nothing(self):
     assert isinstance(SystemDict(), SystemDict)