Skip to content

Commit 2e8b82f

Browse files
author
hartsantler
committed
regression test for custom callable __call__, updated README.
1 parent c3dcb9b commit 2e8b82f

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,15 @@ Supported Features
9595
regular and lambda functions
9696
function calls with *args and **kwargs
9797

98-
98+
####Operator Overloading
99+
100+
__getattr__
101+
__getattribute__
102+
__getitem__
103+
__setitem__
104+
__call__
105+
__iter__
106+
__add__
99107

100108
####builtins
101109

regtests/class/__call__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""custom callable"""
2+
3+
class A:
4+
def __init__(self):
5+
self.x = 5
6+
def __call__(self):
7+
return 'XXX'
8+
9+
10+
def main():
11+
a = A()
12+
TestError(a.x == 5)
13+
TestError( a()=='XXX' )

0 commit comments

Comments
 (0)