def test_topological_sort_with_single_item(): graph = {1: set()} assert [1] == topological_sort(graph)
def test_topological_sort_multiple_paths(): graph = {1: set([2, 3]), 2: set([3])} assert [1, 2, 3] == topological_sort(graph)
def test_topological_sort_raises_on_loop(): graph = {1: set([2]), 2: set([3]), 3: set([1])} with pytest.raises(ValueError): topological_sort(graph)
def test_topological_sort_simple_chain(): graph = {1: set([2]), 2: set([3]), 3: set([4])} assert [1, 2, 3, 4] == topological_sort(graph)