Exemplo n.º 1
0
    def test_compatible(self):
        bridge = Bridge()
        assert bridge.compatible(Component.from_string('0/1'))
        assert not bridge.compatible(Component.from_string('1/1'))

        bridge = bridge.add(Component.from_string('0/1'))
        assert bridge.compatible(Component.from_string('2/1'))
        assert bridge.compatible(Component.from_string('1/2'))
Exemplo n.º 2
0
 def test_str(self):
     component = Component.from_string('0/1')
     assert str(component) == '0/1'
Exemplo n.º 3
0
 def test_two_parallel(self):
     assert set(map(str, Bridge._all_bridges_from_components([
         Component.from_string('0/1'), Component.from_string('0/2')]))) == \
            {'0/1', '0/2'}
Exemplo n.º 4
0
 def test_single_incompatible(self):
     assert set(map(str, Bridge._all_bridges_from_components([
         Component.from_string('1/1')]))) == set()
Exemplo n.º 5
0
 def test_single(self):
     assert set(map(str, Bridge._all_bridges_from_components([
         Component.from_string('0/1')]))) == {'0/1'}
Exemplo n.º 6
0
 def test_from_string(self):
     component = Component.from_string('0/1')
     assert component.ports == [0, 1]
     assert component._available_ports == [0, 1]
Exemplo n.º 7
0
 def test_str(self):
     bridge = Bridge()
     bridge = bridge.add(Component.from_string('0/1'))
     bridge = bridge.add(Component.from_string('10/1'))
     assert str(bridge) == '0/1--10/1'