Skip to content

Commit f77fd62

Browse files
jeplerdpgeorge
authored andcommitted
tests/cpydiff: Document format separator difference.
Signed-off-by: Jeff Epler <[email protected]>
1 parent 9032491 commit f77fd62

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/cpydiff/types_str_formatsep.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""
2+
categories: Types,str
3+
description: MicroPython accepts the "," grouping option with any radix, unlike CPython
4+
cause: To reduce code size, MicroPython does not issue an error for this combination
5+
workaround: Do not use a format string like ``{:,b}`` if CPython compatibility is required.
6+
"""
7+
8+
try:
9+
print("{:,b}".format(99))
10+
except ValueError:
11+
print("ValueError")
12+
try:
13+
print("{:,x}".format(99))
14+
except ValueError:
15+
print("ValueError")
16+
try:
17+
print("{:,o}".format(99))
18+
except ValueError:
19+
print("ValueError")

0 commit comments

Comments
 (0)