Skip to content

Commit

Permalink
tests/basics/class_getattr: Remove invalid test for __getattribute__.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dpgeorge committed Oct 18, 2018
1 parent 7eb29c2 commit a07e56c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tests/basics/class_getattr.py
Original file line number Diff line number Diff line change
@@ -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:
def __init__(self):
self.__add__ = lambda: print('member __add__')
Expand All @@ -7,10 +7,8 @@ def __add__(self, x):
def __getattr__(self, attr):
print('__getattr__', attr)
return None
def __getattrribute__(self, attr):
print('__getattrribute__', attr)
return None

c = C()
c.__add__
c + 1 # should call __add__
c.add # should call __getattr__
c.__add__() # should load __add__ instance directly
c + 1 # should call __add__ method directly

0 comments on commit a07e56c

Please sign in to comment.