def test_forest(self): self.assertEqual( ['a', 'b', 'c', 'd'], topsort(OrderedDict([ ('d', []), ('b', ['c']), ('c', []), ('a', ['b']), ])) )
def test_three_nodes(self): self.assertEqual( ['a', 'b', 'c'], topsort(dict(a=['b'], b=['c'], c=[])) )
def test_single_node(self): self.assertEqual( ['a'], topsort(dict(a=[])) )
def test_two_nodes(self): self.assertEqual( ['a', 'b'], topsort(dict(a=['b'], b=[])) )
def test_empty_graph(self): self.assertEqual( [], topsort(dict()) )