Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0dda85a

Browse files
committed
Improve test.
1 parent 0f7876f commit 0dda85a

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/tests/test_subclass.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,19 +192,15 @@ def test_isinstance_check():
192192
assert isinstance(x, System.String)
193193

194194

195-
_derived_cons_calls = 0
196-
197195
def test_derived_constructor_only_called_once():
198-
global _derived_cons_calls
199-
_derived_cons_calls = 0
196+
calls = []
200197

201198
class X(System.Object):
202199
__namespace__ = "PyTest"
203200

204-
def __init__(self):
205-
global _derived_cons_calls
206-
_derived_cons_calls += 1
201+
def __init__(self, *args):
202+
calls.append(args)
207203

208-
x = X()
204+
x = X(1, 2)
209205

210-
assert _derived_cons_calls == 1
206+
assert calls == [(1, 2)]

0 commit comments

Comments
 (0)