def test_removal_of_non_existent_node_should_fail(): g = Graph() g.add(10) assert set(g.nodes()) == {10} try: g.remove(12) except KeyError: assert True else: assert False
def test_can_remove(): g = Graph() g.add(10) assert set(g.nodes()) == {10} g.remove(10) assert set(g.nodes()) == set()