tests/cpydiff: Document format separator difference.

Signed-off-by: Jeff Epler <jepler@gmail.com>
This commit is contained in:
Jeff Epler
2025-05-12 17:39:16 +02:00
committed by Damien George
parent 9032491efd
commit f77fd6257c

View File

@@ -0,0 +1,19 @@
"""
categories: Types,str
description: MicroPython accepts the "," grouping option with any radix, unlike CPython
cause: To reduce code size, MicroPython does not issue an error for this combination
workaround: Do not use a format string like ``{:,b}`` if CPython compatibility is required.
"""
try:
print("{:,b}".format(99))
except ValueError:
print("ValueError")
try:
print("{:,x}".format(99))
except ValueError:
print("ValueError")
try:
print("{:,o}".format(99))
except ValueError:
print("ValueError")