mirror of
https://github.com/micropython/micropython.git
synced 2026-03-10 10:50:17 +01:00
Includes corresponding .exp files because this feature is only available in Python 3.14+. Tests for `!a` conversion specifier and space after `!` are not included because they are not supported by MicroPython. Signed-off-by: Koudai Aono <koxudaxi@gmail.com> Signed-off-by: Damien George <damien@micropython.org>
25 lines
756 B
Python
25 lines
756 B
Python
# NOTE: Error messages are shortened in MicroPython to avoid stack overflow
|
|
# during ROM compression on constrained platforms (Windows x86, ASan).
|
|
# CPython 3.14 message: "Template.__new__ *args need to be of type 'str' or 'Interpolation', got int"
|
|
# MicroPython message: "Template.__new__ args must be str or Interpolation, got 'int'"
|
|
|
|
from string.templatelib import Template
|
|
|
|
print("=== Constructor error messages ===")
|
|
try:
|
|
Template(strings=("test",))
|
|
except TypeError as e:
|
|
print(f"Keyword args: {e}")
|
|
|
|
try:
|
|
Template("hello", 42, "world")
|
|
except TypeError as e:
|
|
print(f"Invalid type: {e}")
|
|
|
|
try:
|
|
Template("a", 42, "b")
|
|
except TypeError as e:
|
|
print(f"Invalid type in varargs: {e}")
|
|
|
|
print("\nConstructor error tests completed!")
|