summaryrefslogtreecommitdiff
path: root/tests/float/string_format.py
diff options
context:
space:
mode:
authorKevin Matocha <kmatocha@icloud.com>2021-03-17 09:30:51 -0500
committerKevin Matocha <kmatocha@icloud.com>2021-03-17 09:30:51 -0500
commitef91e1752c233e45bfa898eb67caab44f1b02313 (patch)
tree9b6f26eb1bd0d54143b4d174cec720dcaca8065e /tests/float/string_format.py
parent870dadc85adce4f10fa57dda1d11dda48b25dbc1 (diff)
parentbfc8c89536e12dba0cc9adc0065819d730bb0983 (diff)
merge upstream/main
Diffstat (limited to 'tests/float/string_format.py')
-rw-r--r--tests/float/string_format.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/float/string_format.py b/tests/float/string_format.py
index 6fb11c35a..92632fe5e 100644
--- a/tests/float/string_format.py
+++ b/tests/float/string_format.py
@@ -1,5 +1,6 @@
def test(fmt, *args):
- print('{:8s}'.format(fmt) + '>' + fmt.format(*args) + '<')
+ print("{:8s}".format(fmt) + ">" + fmt.format(*args) + "<")
+
test("{:10.4}", 123.456)
test("{:10.4e}", 123.456)
@@ -25,17 +26,17 @@ test("{:06e}", float("-inf"))
test("{:06e}", float("nan"))
# The following fails right now
-#test("{:10.1}", 0.0)
+# test("{:10.1}", 0.0)
print("%.0f" % (1.750000 % 0.08333333333))
# Below isn't compatible with single-precision float
-#print("%.1f" % (1.750000 % 0.08333333333))
-#print("%.2f" % (1.750000 % 0.08333333333))
-#print("%.12f" % (1.750000 % 0.08333333333))
+# print("%.1f" % (1.750000 % 0.08333333333))
+# print("%.2f" % (1.750000 % 0.08333333333))
+# print("%.12f" % (1.750000 % 0.08333333333))
# tests for errors in format string
try:
- '{:10.1b}'.format(0.0)
+ "{:10.1b}".format(0.0)
except ValueError:
- print('ValueError')
+ print("ValueError")