summaryrefslogtreecommitdiff
path: root/tests/float/string_format.py
diff options
context:
space:
mode:
authorJeff Epler <jeff@adafruit.com>2021-03-15 13:50:49 -0500
committerGitHub <noreply@github.com>2021-03-15 13:50:49 -0500
commit05ed179e11599dd45a76dfb14ecf624d0ff96d68 (patch)
treea046c6d1f117814168150484ed1bf7840d3400d7 /tests/float/string_format.py
parent3cbff45f9aac5ea2855bbc888083d356a91c80fe (diff)
parentf9b4189b4c640823dabb76de8effd2a836da2eb0 (diff)
Merge pull request #4362 from microDev1/code-formatting
Add code formatting and translations check
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")