8000 tests/class_new: Add checks for __init__ being called and other impro… · nickzoic/micropython-esp32@35be9e8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 35be9e8

Browse files
committed
tests/class_new: Add checks for __init__ being called and other improvements.
1 parent b565c36 commit 35be9e8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/basics/class_new.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
except AttributeError:
66
print("SKIP")
77
raise SystemExit
8+
89
class A:
910
def __new__(cls):
1011
print("A.__new__")
1112
return super(cls, A).__new__(cls)
1213

1314
def __init__(self):
14-
pass
15+
print("A.__init__")
1516

1617
def meth(self):
1718
print('A.meth')
@@ -35,5 +36,10 @@ def meth(self):
3536

3637
class B:
3738
def __new__(self, v1, v2):
38-
None
39-
B(1, 2)
39+
print("B.__new__", v1, v2)
40+
41+
def __init__(self, v1, v2):
42+
# Should not be called in this test
43+
print("B.__init__", v1, v2)
44+
45+
print("B inst:", B(1, 2))

0 commit comments

Comments
 (0)
0