def test_get_item_throws_error_when_component_is_not_in_list_then_works_when_item_is_set(
):
    name = "component1"
    test = Component(name)

    list_of_components = []

    assert _get_item(list_of_components, name) is None

    _set_item(None, list_of_components, name, test)
    assert _get_item(list_of_components, name) == test
Ejemplo n.º 2
0
 def __contains__(self, item: str):
     result = None
     try:
         result = _get_item(self.children, item)
     except AttributeError:
         pass
     return True if result is not None else False
Ejemplo n.º 3
0
 def __getitem__(self, key: str):
     return _get_item(self.children, key)
def test_get_item_returns_correct_component_when_given_component_is_in_list():
    name = "component1"
    test = Component(name)

    list_of_components = [test]
    assert _get_item(list_of_components, name) == test
Ejemplo n.º 5
0
 def contains_attribute(self, attribute_name):
     result = _get_item(self, attribute_name)
     return True if result is not None else False
Ejemplo n.º 6
0
 def get_attribute_value(self, attribute_name: str):
     if self.contains_attribute(attribute_name):
         return _get_item(self, attribute_name).values
     return None