diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-30 10:05:33 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-30 10:05:33 +0000 |
commit | 09a0c64bce93f5ebcea82e81b4b07ddd7ff76cc7 (patch) | |
tree | 5083bfffe18f07af6a3030199914459684a89a09 /tests | |
parent | b25711ea8fdc1588b5a69f7d0941de09b50fa28c (diff) | |
download | micropython-09a0c64bce93f5ebcea82e81b4b07ddd7ff76cc7.tar.gz micropython-09a0c64bce93f5ebcea82e81b4b07ddd7ff76cc7.zip |
py: Improve __bool__ and __len__ dispatch; add slots for them.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basics/slots_bool_len.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/basics/slots_bool_len.py b/tests/basics/slots_bool_len.py new file mode 100644 index 0000000000..481fe9b4e6 --- /dev/null +++ b/tests/basics/slots_bool_len.py @@ -0,0 +1,17 @@ +class A: + def __bool__(self): + print('__bool__') + return True + def __len__(self): + print('__len__') + return 1 + +class B: + def __len__(self): + print('__len__') + return 0 + +print(bool(A())) +print(len(A())) +print(bool(B())) +print(len(B())) |