Skip to content

Commit 1106f7c

Browse files
committed
Rename test Op to not confuse pytest
1 parent 613ccaf commit 1106f7c

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tests/tensor/test_blockwise.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ def test_runtime_broadcast(mode):
8888
check_blockwise_runtime_broadcasting(mode)
8989

9090

91-
class TestOp(Op):
91+
class MyTestOp(Op):
9292
def make_node(self, *inputs):
9393
return Apply(self, inputs, [i.type() for i in inputs])
9494

9595
def perform(self, *args, **kwargs):
9696
raise NotImplementedError("Test Op should not be present in final graph")
9797

9898

99-
test_op = TestOp()
99+
test_op = MyTestOp()
100100

101101

102102
def test_vectorize_node_default_signature():
@@ -106,12 +106,12 @@ def test_vectorize_node_default_signature():
106106

107107
vect_node = vectorize_node(node, mat, mat)
108108
assert isinstance(vect_node.op, Blockwise) and isinstance(
109-
vect_node.op.core_op, TestOp
109+
vect_node.op.core_op, MyTestOp
110110
)
111111
assert vect_node.op.signature == ("(i00),(i10,i11)->(o00),(o10,o11)")
112112

113113
with pytest.raises(
114-
ValueError, match="Signature not provided nor found in core_op TestOp"
114+
ValueError, match="Signature not provided nor found in core_op MyTestOp"
115115
):
116116
Blockwise(test_op)
117117

@@ -138,7 +138,7 @@ def test_blockwise_shape():
138138

139139
shape_fn = pytensor.function([inp], out.shape)
140140
assert not any(
141-
isinstance(getattr(n.op, "core_op", n.op), TestOp)
141+
isinstance(getattr(n.op, "core_op", n.op), MyTestOp)
142142
for n in shape_fn.maker.fgraph.apply_nodes
143143
)
144144
assert tuple(shape_fn(inp_test)) == (5, 3, 4)
@@ -150,13 +150,13 @@ def test_blockwise_shape():
150150

151151
shape_fn = pytensor.function([inp], out.shape)
152152
assert any(
153-
isinstance(getattr(n.op, "core_op", n.op), TestOp)
153+
isinstance(getattr(n.op, "core_op", n.op), MyTestOp)
154154
for n in shape_fn.maker.fgraph.apply_nodes
155155
)
156156

157157
shape_fn = pytensor.function([inp], out.shape[:-1])
158158
assert not any(
159-
isinstance(getattr(n.op, "core_op", n.op), TestOp)
159+
isinstance(getattr(n.op, "core_op", n.op), MyTestOp)
160160
for n in shape_fn.maker.fgraph.apply_nodes
161161
)
162162
assert tuple(shape_fn(inp_test)) == (5, 4)
@@ -174,20 +174,20 @@ def test_blockwise_shape():
174174

175175
shape_fn = pytensor.function([inp1, inp2], [out.shape for out in outs])
176176
assert any(
177-
isinstance(getattr(n.op, "core_op", n.op), TestOp)
177+
isinstance(getattr(n.op, "core_op", n.op), MyTestOp)
178178
for n in shape_fn.maker.fgraph.apply_nodes
179179
)
180180

181181
shape_fn = pytensor.function([inp1, inp2], outs[0].shape)
182182
assert not any(
183-
isinstance(getattr(n.op, "core_op", n.op), TestOp)
183+
isinstance(getattr(n.op, "core_op", n.op), MyTestOp)
184184
for n in shape_fn.maker.fgraph.apply_nodes
185185
)
186186
assert tuple(shape_fn(inp1_test, inp2_test)) == (7, 5, 3, 4)
187187

188188
shape_fn = pytensor.function([inp1, inp2], [outs[0].shape, outs[1].shape[:-1]])
189189
assert not any(
190-
isinstance(getattr(n.op, "core_op", n.op), TestOp)
190+
isinstance(getattr(n.op, "core_op", n.op), MyTestOp)
191191
for n in shape_fn.maker.fgraph.apply_nodes
192192
)
193193
assert tuple(shape_fn(inp1_test, inp2_test)[0]) == (7, 5, 3, 4)

0 commit comments

Comments
 (0)