diff options
Diffstat (limited to 'tests/float/string_format.py')
-rw-r--r-- | tests/float/string_format.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/tests/float/string_format.py b/tests/float/string_format.py index 54f1270773..13382b9037 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) @@ -24,21 +25,21 @@ test("{:06e}", float("inf")) test("{:06e}", float("-inf")) test("{:06e}", float("nan")) -test('{:f}', False) -test('{:f}', True) +test("{:f}", False) +test("{:f}", True) # 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") |