tests/basics/class_getattr: Remove invalid test for __getattribute__.
Part of this test was trying to test some functionality of __getattribute__ but this method name was misspelt so it wasn't doing anything useful. Fixing the typo in this name makes the test fail because MicroPython doesn't support user defined __getattribute__ methods. So this part of the test is removed. The remaining tests are modified slightly to make it clearer what they are testing.
This commit is contained in:
parent
7eb29c2000
commit
a07e56cbd8
@ -1,4 +1,4 @@
|
|||||||
# test that __getattr__, __getattrribute__ and instance members don't override builtins
|
# test that __getattr__ and instance members don't override builtins
|
||||||
class C:
|
class C:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.__add__ = lambda: print('member __add__')
|
self.__add__ = lambda: print('member __add__')
|
||||||
@ -7,10 +7,8 @@ class C:
|
|||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
print('__getattr__', attr)
|
print('__getattr__', attr)
|
||||||
return None
|
return None
|
||||||
def __getattrribute__(self, attr):
|
|
||||||
print('__getattrribute__', attr)
|
|
||||||
return None
|
|
||||||
|
|
||||||
c = C()
|
c = C()
|
||||||
c.__add__
|
c.add # should call __getattr__
|
||||||
c + 1 # should call __add__
|
c.__add__() # should load __add__ instance directly
|
||||||
|
c + 1 # should call __add__ method directly
|
||||||
|
Loading…
Reference in New Issue
Block a user