Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
9ede4dcf
Commit
9ede4dcf
authored
May 28, 2015
by
Damien George
Browse files
tests: Add some tests for printing floats to improve coverage.
parent
79474c6b
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/float/string_format.py
View file @
9ede4dcf
...
...
@@ -122,6 +122,9 @@ if full_tests:
test_fmt
(
''
,
fill
,
alignment
,
sign
,
''
,
width
,
prec
,
type
,
num
)
for
num
in
pct_nums2
:
test_fmt
(
''
,
fill
,
alignment
,
sign
,
''
,
width
,
''
,
type
,
num
)
else
:
for
num
in
pct_nums1
:
test_fmt
(
''
,
''
,
''
,
''
,
''
,
''
,
'1'
,
'%'
,
num
)
# We don't currently test a type of '' with floats (see the detailed comment
# in objstr.c)
tests/float/string_format_modulo.py
View file @
9ede4dcf
...
...
@@ -21,3 +21,8 @@ print("%G" % 1.23456)
print
(
"%06e"
%
float
(
"inf"
))
print
(
"%06e"
%
float
(
"-inf"
))
print
(
"%06e"
%
float
(
"nan"
))
print
(
"%02.3d"
%
123
)
# prec > width
print
(
"%+f %+f"
%
(
1.23
,
-
1.23
))
# float sign
print
(
"% f % f"
%
(
1.23
,
-
1.23
))
# float space sign
print
(
"%0f"
%
-
1.23
)
# negative number with 0 padding
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment