Add test for __set_name__
This commit is contained in:
parent
2d8de139b3
commit
c9b989cb56
13
test/testSetName.krk
Normal file
13
test/testSetName.krk
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
class Foo():
|
||||||
|
def __init__(self,v):
|
||||||
|
self.v = v
|
||||||
|
def __set_name__(self, owner, name):
|
||||||
|
print(f'{owner.__name__} setting "{name}" to Foo({self.v})')
|
||||||
|
|
||||||
|
class Bar():
|
||||||
|
a = Foo('1')
|
||||||
|
b = Foo('2')
|
||||||
|
c = Foo('3')
|
||||||
|
|
||||||
|
class Baz(Bar):
|
||||||
|
d = Foo('4')
|
4
test/testSetName.krk.expect
Normal file
4
test/testSetName.krk.expect
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Bar setting "a" to Foo(1)
|
||||||
|
Bar setting "b" to Foo(2)
|
||||||
|
Bar setting "c" to Foo(3)
|
||||||
|
Baz setting "d" to Foo(4)
|
Loading…
Reference in New Issue
Block a user