diff options
author | Damien George <damien.p.george@gmail.com> | 2016-08-17 12:38:19 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-08-17 12:38:19 +1000 |
commit | bb19e7b94bd8cc69b75e6d39dd9f2ec6e0cebba6 (patch) | |
tree | ee26fee9cf06f06a4859fad19ff70e0a8dbdd500 /tests/basics/special_methods.py | |
parent | f003310deeaf524a7db4428304f6cbdd2aa80e72 (diff) | |
download | micropython-bb19e7b94bd8cc69b75e6d39dd9f2ec6e0cebba6.tar.gz micropython-bb19e7b94bd8cc69b75e6d39dd9f2ec6e0cebba6.zip |
tests/basics/special_methods: Enable tests for extra special methods.
These additional special methods are enabled on most ports so we can test
them in this test.
Diffstat (limited to 'tests/basics/special_methods.py')
-rw-r--r-- | tests/basics/special_methods.py | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/tests/basics/special_methods.py b/tests/basics/special_methods.py index b4eb8710d3..1df7a7c4c7 100644 --- a/tests/basics/special_methods.py +++ b/tests/basics/special_methods.py @@ -85,8 +85,17 @@ class Cud(): def __xor__(self, other): print("__xor__ called") + def __iadd__(self, other): + print("__iadd__ called") + return self + + def __isub__(self, other): + print("__isub__ called") + return self + cud1 = Cud() cud2 = Cud() + str(cud1) cud1 < cud2 cud1 <= cud2 @@ -94,6 +103,17 @@ cud1 == cud2 cud1 >= cud2 cud1 > cud2 cud1 + cud2 +cud1 - cud2 + +# the following require MICROPY_PY_ALL_SPECIAL_METHODS ++cud1 +-cud1 +~cud1 +cud1 * cud2 +cud1 / cud2 +cud2 // cud1 +cud1 += cud2 +cud1 -= cud2 # TODO: the following operations are not supported on every ports # @@ -103,48 +123,21 @@ cud1 + cud2 # binary and is not supported # cud1 & cud2 # -# floor div is not supported on the qemu arm port -# cud2 // cud1 -# -# inv is not supported on the qemu arm port -# ~cud1 -# # binary lshift is not supported # cud1<<1 # # modulus is not supported # cud1 % 2 # -# mult is not supported on the qemu arm port -# cud1 * cud2 -# -# mult is not supported on the qemu arm port -# cud1 * 2 -# -# inv is not supported on the qemu arm port -# -cud1 -# # binary or is not supported # cud1 | cud2 # -# pos is not supported on the qemu arm port -# +cud1 -# # pow is not supported # cud1**2 # # rshift is not suported # cud1>>1 # -# sub is not supported on the qemu arm port -# cud1 - cud2 -# -# div is not supported on the qemu arm port -# cud1 / cud2 -# -# div is not supported on the qemu arm port -# cud1 / 2 -# # xor is not supported # cud1^cud2 # |