Skip to content

Commit f77fd62

Browse files
jeplerdpgeorge
authored andcommitted
tests/cpydiff: Document format separator difference.
Signed-off-by: Jeff Epler <jepler@gmail.com>
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy