Commit 4d05ba25 authored by Stefan Behnel's avatar Stefan Behnel

include octal number formatting in fstring tests

parent eb6e28cf
...@@ -55,7 +55,7 @@ def format_c_numbers(signed char c, short s, int n, long l, float f, double d): ...@@ -55,7 +55,7 @@ def format_c_numbers(signed char c, short s, int n, long l, float f, double d):
>>> print(s3) >>> print(s3)
12f 12f
>>> print(s4) >>> print(s4)
0C00C 3.14 0C014 3.14
>>> s1, s2, s3, s4 = format_c_numbers(-123, -135, -12, -12312312, -2.3456, -3.1415926) >>> s1, s2, s3, s4 = format_c_numbers(-123, -135, -12, -12312312, -2.3456, -3.1415926)
>>> print(s1) >>> print(s1)
...@@ -65,7 +65,7 @@ def format_c_numbers(signed char c, short s, int n, long l, float f, double d): ...@@ -65,7 +65,7 @@ def format_c_numbers(signed char c, short s, int n, long l, float f, double d):
>>> print(s3) >>> print(s3)
-12f -12f
>>> print(s4) >>> print(s4)
-C-0C-3.14 -C-14-3.14
""" """
s1 = f"{c}{s:4}{l}{n}{f:.3}" s1 = f"{c}{s:4}{l}{n}{f:.3}"
...@@ -74,7 +74,7 @@ def format_c_numbers(signed char c, short s, int n, long l, float f, double d): ...@@ -74,7 +74,7 @@ def format_c_numbers(signed char c, short s, int n, long l, float f, double d):
assert isinstance(s2, unicode), type(s2) assert isinstance(s2, unicode), type(s2)
s3 = f"{n:-4}f" s3 = f"{n:-4}f"
assert isinstance(s3, unicode), type(s3) assert isinstance(s3, unicode), type(s3)
s4 = f"{n:02X}{n:03X}{d:5.3}" s4 = f"{n:02X}{n:03o}{d:5.3}"
assert isinstance(s4, unicode), type(s4) assert isinstance(s4, unicode), type(s4)
return s1, s2, s3, s4 return s1, s2, s3, s4
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment