summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/string_format_modulo.py
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2023-06-01 12:12:22 +1000
committerDamien George <damien@micropython.org>2023-06-01 14:18:54 +1000
commit66dc1397c92f6accf102bcd15c6395902fd46c8b (patch)
treeb9743d03804279fa38222bc2b5edb6da2756ff5b /tests/basics/string_format_modulo.py
parent48ffd6596e7a4c185a81be233b46d3c99a83a7ac (diff)
downloadmicropython-66dc1397c92f6accf102bcd15c6395902fd46c8b.tar.gz
micropython-66dc1397c92f6accf102bcd15c6395902fd46c8b.zip
py/obj: Accept user types in mp_obj_get_int_maybe.
This is possible now that MP_UNARY_OP_INT_MAYBE exists. As a consequence mp_obj_get_int now also supports user types, which was previously possible with MP_UNARY_OP_INT but no tests existed for it. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/basics/string_format_modulo.py')
-rw-r--r--tests/basics/string_format_modulo.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/basics/string_format_modulo.py b/tests/basics/string_format_modulo.py
index 01f8e7ed24..14b4a6a484 100644
--- a/tests/basics/string_format_modulo.py
+++ b/tests/basics/string_format_modulo.py
@@ -13,6 +13,12 @@ print("=%s=" % [1, 2])
print("=%s=" % "str")
print("=%r=" % "str")
+# test calling __int__
+class A:
+ def __int__(self):
+ return 123
+print("%d" % A())
+
try:
print("=%s=%s=" % 1)
except TypeError: