def test_iterable(normalized_topology_example): """Проверка работы Topology как итерируемого объекта""" top1 = task_23_3a.Topology(normalized_topology_example) try: iterator = iter(top1) except TypeError as error: pytest.fail("Экземпляр класса Topology не итерируемый объект\n", error) else: item = next(iterator) assert (("R1", "Eth0/0"), ("SW1", "Eth0/1")) == item
def test_iterable(normalized_topology_example): top1 = task_23_3a.Topology(normalized_topology_example) try: iterator = iter(top1) except TypeError as error: pytest.fail( "An instance of the Topology class is a non-iterable object\n", error ) else: item = next(iterator) assert (("R1", "Eth0/0"), ("SW1", "Eth0/1")) == item
def test_topology_normalization(topology_with_dupl_links, normalized_topology_example): """Проверка удаления дублей в топологии""" top_with_data = task_23_3a.Topology(topology_with_dupl_links) assert len(top_with_data.topology) == len(normalized_topology_example)
def test_attr_topology(topology_with_dupl_links): """Проверяем, что в объекте Topology есть атрибут topology""" top_with_data = task_23_3a.Topology(topology_with_dupl_links) check_attr_or_method(top_with_data, attr="topology")
def test_topology_normalization(topology_with_dupl_links, normalized_topology_example): """Checking the removal of duplicates in a topology""" top_with_data = task_23_3a.Topology(topology_with_dupl_links) assert len(normalized_topology_example) == len(top_with_data.topology)
def test_attr_topology(topology_with_dupl_links): """Checking that the Topology object has a topology attribute""" top_with_data = task_23_3a.Topology(topology_with_dupl_links) check_attr_or_method(top_with_data, attr="topology")