def test_create_with_mixed_args(self):
            scrambled = ["n1", "n2", Pin(None, "n3"), Pin(None, "n4"), "n5"]
            pinlist = PinList(None, *scrambled)
            assert len(pinlist) == 5

            for pin in pinlist:
                assert pin.pinlist is pinlist
Exemple #2
0
        def test_create_with_mixed_args(self):
            scrambled = ['n1', 'n2', Pin(None, 'n3'), Pin(None, 'n4'), 'n5']
            pinlist = PinList(None, *scrambled)
            assert len(pinlist) == 5

            for pin in pinlist:
                assert pin.pinlist is pinlist
Exemple #3
0
        def test_create_with_pins(self):
            length = 4
            pins = [Pin(None, 'n' + str(i)) for i in range(length)]
            pinlist = PinList(None, *pins)
            assert len(pinlist) == length

            npin = iter(pins)
            for pin in pinlist:
                assert pin.pinlist is pinlist
                assert pin is next(npin)
Exemple #4
0
 def setup_method(self):
     self.length = 8
     self.pins = [Pin(None, 'n' + str(i)) for i in range(self.length)]
     self.pinlist1 = PinList(None, *self.pins[:int(self.length / 2)])
     self.pinlist2 = PinList(None, *self.pins[int(self.length / 2):])
Exemple #5
0
 def setup_method(self):
     self.length = 4
     self.pins = [Pin(None, 'n' + str(i)) for i in range(self.length)]
     self.pinlist = PinList(None, *self.pins)
Exemple #6
0
 def test_rename(self):
     name = 'oldname'
     p1 = Pin(None, name)
     name = 'newname'
     p1.name = name
     assert p1.name == name
Exemple #7
0
 def test_args(self):
     name = 'n1'
     p1 = Pin(None, name)
     assert p1.name == name
Exemple #8
0
 def test_noargs(self):
     p1 = Pin(None, None)
     with pytest.raises(AttributeError):
         p1.element
     with pytest.raises(AttributeError):
         p1.index
 def test_rename(self):
     name = "oldname"
     p1 = Pin(None, name)
     name = "newname"
     p1.name = name
     assert p1.name == name