def test_promote_hub_a_followed_node(self): h = HubDispatch().add_hub('A').link('A', 'B') h._changes._clear() h.add_hub('B') self.assertEqual(h._topology.nodes, { 'A': 'A', 'B': 'A' }) self.assertEqual(h._topology.hubs, {'A': 2})
def test_add_hub_linked_to_node(self): h = HubDispatch() h.add_hub('foo') self.assertEqual(h._changes.assignments, [('foo', 'foo')]) h.link('foo', 'bar') self.assertEqual( h._topology.nodes, {'bar': 'foo', 'foo': 'foo'}, ) self.assertEqual( h._topology.hubs, {'foo': 2}, ) self.assertEqual(h._changes.assignments, [ ('foo', 'foo'), ('foo', 'bar') ]) h._changes._clear()
def test_add_hub_linked_to_node(self): h = HubDispatch() h.add_hub('foo') self.assertEqual(h._changes.assignments, [('foo', 'foo')]) h.link('foo', 'bar') self.assertEqual( h._topology.nodes, { 'bar': 'foo', 'foo': 'foo' }, ) self.assertEqual( h._topology.hubs, {'foo': 2}, ) self.assertEqual(h._changes.assignments, [('foo', 'foo'), ('foo', 'bar')]) h._changes._clear()
def test_promote_hub_a_followed_node(self): h = HubDispatch().add_hub('A').link('A', 'B') h._changes._clear() h.add_hub('B') self.assertEqual(h._topology.nodes, {'A': 'A', 'B': 'A'}) self.assertEqual(h._topology.hubs, {'A': 2})