@@ -27,6 +27,16 @@ def test_gpr() -> None:
27
27
assert len (gpr1 .genes ) == 0
28
28
29
29
30
+ def test_grp_copy () -> None :
31
+ """Test that copying a GPR works."""
32
+ gpr1 = GPR .from_string ("(A and B) or C" )
33
+ gpr2 = gpr1 .copy ()
34
+ assert gpr1 == gpr2
35
+ assert id (gpr1 .body ) is not id (gpr2 .body )
36
+ assert gpr1 ._genes == gpr2 ._genes
37
+ assert id (gpr1 ._genes ) is not id (gpr2 ._genes )
38
+
39
+
30
40
@pytest .mark .parametrize ("test_input" , ["" , "" , None ])
31
41
def test_empty_gpr (test_input ) -> None :
32
42
"""Test empty GPR."""
@@ -89,7 +99,6 @@ def test_and_gpr(gpr_input, num_genes, gpr_genes, gpr_output_string) -> None:
89
99
for ko_genes in powerset_ne (gpr_genes ):
90
100
assert not gpr1 .eval (ko_genes )
91
101
assert gpr1 .body
92
- gpr1 .copy ()
93
102
94
103
95
104
def all_except_one (iterable : Iterable [str ]) -> Iterator [Tuple [str , ...]]:
@@ -132,7 +141,6 @@ def test_or_gpr(
132
141
assert gpr1 .eval (ko_genes )
133
142
assert not gpr1 .eval (gpr_genes )
134
143
assert gpr1 .body
135
- gpr1 .copy ()
136
144
137
145
138
146
@pytest .mark .parametrize (
@@ -158,7 +166,6 @@ def test_complicated_gpr(gpr_input: str) -> None:
158
166
assert not gpr1 .eval ("c" )
159
167
assert not gpr1 .eval (["a" , "b" ])
160
168
assert not gpr1 .eval (["a" , "b" , "c" ])
161
- gpr1 .copy ()
162
169
163
170
164
171
@pytest .mark .parametrize (
@@ -185,7 +192,6 @@ def test_gpr_from_ast_or(
185
192
for ko_genes in all_except_one (gpr_genes ):
186
193
assert gpr1 .eval (ko_genes )
187
194
assert not gpr1 .eval (gpr_genes )
188
- gpr1 .copy ()
189
195
190
196
191
197
@pytest .mark .parametrize (
@@ -210,7 +216,6 @@ def test_gpr_from_ast_and(
210
216
assert gpr1 .eval ()
211
217
for ko_genes in powerset_ne (gpr_genes ):
212
218
assert not gpr1 .eval (ko_genes )
213
- gpr1 .copy ()
214
219
215
220
216
221
@pytest .mark .parametrize ("test_input" , [["a" , "b" ], {"a" , "b" }])
0 commit comments