mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 11:40:18 +01:00
Changes here are: - Split out string format module sub-test to a separate test file, so it can be skipped on targets that don't have str% capabilities. - Print the whole type instead of `.__name__` to support targets that don't have `.__name__` enabled (this still tests the same thing). - Print `RuntimeError` exception message to be sure the correct exception is being raised. This test now runs on unix and zephyr minimal configurations. Signed-off-by: Damien George <damien@micropython.org>
22 lines
517 B
Python
22 lines
517 B
Python
# Test interning qstrs that go over the qstr length limit (255 bytes in default configuration).
|
|
# The tests here are specifically for str formatting with %.
|
|
|
|
try:
|
|
"" % ()
|
|
except TypeError:
|
|
print("SKIP")
|
|
raise SystemExit
|
|
|
|
|
|
def make_id(n, base="a"):
|
|
return "".join(chr(ord(base) + i % 26) for i in range(n))
|
|
|
|
|
|
# modulo format with keys
|
|
for l in range(254, 259):
|
|
id = make_id(l)
|
|
try:
|
|
print(("%(" + id + ")d") % {id: l})
|
|
except RuntimeError as er:
|
|
print("RuntimeError", er, l)
|