Skip to content

Commit 3695211

Browse files
committed
tests/float/float_format_ints.py: Put power-of-10 test in separate file.
This test doesn't pass on builds with 30-bit floats (object repr C). Signed-off-by: Damien George <damien@micropython.org>
1 parent 52f76cf commit 3695211

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

tests/float/float_format_ints.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212
print(title, "with format", f_fmt, "gives", f_fmt.format(f))
1313
print(title, "with format", g_fmt, "gives", g_fmt.format(f))
1414

15-
# Check that powers of 10 (that fit in float32) format correctly.
16-
for i in range(31):
17-
# It works to 12 digits on all platforms *except* qemu-arm, where
18-
# 10^11 comes out as 10000000820 or something.
19-
print("{:.7g}".format(float("1e" + str(i))))
20-
2115
# 16777215 is 2^24 - 1, the largest integer that can be completely held
2216
# in a float32.
2317
print("{:f}".format(16777215))
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Test that integers format to exact values.
2+
# This test requires at least 32-bit floats (won't work with 30-bit).
3+
4+
# Check that powers of 10 (that fit in float32) format correctly.
5+
for i in range(31):
6+
# It works to 12 digits on all platforms *except* qemu-arm, where
7+
# 10^11 comes out as 10000000820 or something.
8+
print(i, "{:.7g}".format(float("1e" + str(i))))

tests/run-tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
525525
) # requires fp32, there's string_format_fp30.py instead
526526
skip_tests.add("float/bytes_construct.py") # requires fp32
527527
skip_tests.add("float/bytearray_construct.py") # requires fp32
528+
skip_tests.add("float/float_format_ints_power10.py") # requires fp32
528529
if upy_float_precision < 64:
529530
skip_tests.add("float/float_divmod.py") # tested by float/float_divmod_relaxed.py instead
530531
skip_tests.add("float/float2int_doubleprec_intbig.py")

0 commit comments

Comments
 (0)