34
34
class TestWires :
35
35
"""Tests for the ``Wires`` class."""
36
36
37
- def test_wires_object_as_label (self ):
38
- """Tests that a Wires object can be used as a label for another Wires object."""
39
- assert Wires ([0 , 1 ]) == Wires ([Wires ([0 ]), Wires ([1 ])])
40
- assert Wires (["a" , "b" , 1 ]) == Wires ([Wires (["a" , "b" ]), Wires ([1 ])])
41
- assert Wires ([Wires ([(0 , 0 ), (0 , 1 )])]) == Wires ([(0 , 0 ), (0 , 1 )])
42
-
43
37
def test_error_if_wires_none (self ):
44
38
"""Tests that a TypeError is raised if None is given as wires."""
45
39
with pytest .raises (TypeError , match = "Must specify a set of wires." ):
@@ -80,7 +74,7 @@ def test_creation_from_wires_lists(self):
80
74
"""Tests that a Wires object can be created from a list of Wires."""
81
75
82
76
wires = Wires ([Wires ([0 ]), Wires ([1 ]), Wires ([2 ])])
83
- assert wires .labels == (0 , 1 , 2 )
77
+ assert wires .labels == (Wires ([ 0 ]), Wires ([ 1 ]), Wires ([ 2 ]) )
84
78
85
79
@pytest .mark .parametrize (
86
80
"iterable" , [[1 , 0 , 4 ], ["a" , "b" , "c" ], [0 , 1 , None ], ["a" , 1 , "ancilla" ]]
@@ -154,7 +148,7 @@ def test_contains(
154
148
wires = Wires ([0 , 1 , 2 , 3 , Wires ([4 , 5 ]), None ])
155
149
156
150
assert 0 in wires
157
- assert Wires ([4 , 5 ]) not in wires
151
+ assert Wires ([4 , 5 ]) in wires
158
152
assert None in wires
159
153
assert Wires ([1 ]) not in wires
160
154
assert Wires ([0 , 3 ]) not in wires
@@ -176,7 +170,7 @@ def test_contains_wires(
176
170
177
171
assert not wires .contains_wires (0 ) # wrong type
178
172
assert not wires .contains_wires ([0 , 1 ]) # wrong type
179
- assert wires .contains_wires (
173
+ assert not wires .contains_wires (
180
174
Wires ([4 , 5 ])
181
175
) # looks up 4 and 5 in wires, which are not present
182
176
0 commit comments