tests/cpydiff: Document format separator difference.
Signed-off-by: Jeff Epler <jepler@gmail.com>
This commit is contained in:
committed by
Damien George
parent
9032491efd
commit
f77fd6257c
19
tests/cpydiff/types_str_formatsep.py
Normal file
19
tests/cpydiff/types_str_formatsep.py
Normal 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")
|
||||||
Reference in New Issue
Block a user