Commit 7210462c authored by Stefan Behnel's avatar Stefan Behnel

Fix fstring tests in Py2.6.

parent 3279482a
...@@ -167,7 +167,7 @@ def format_c_number_range_width(int n): ...@@ -167,7 +167,7 @@ def format_c_number_range_width(int n):
""" """
>>> for i in range(-1000, 1001): >>> for i in range(-1000, 1001):
... formatted = format_c_number_range_width(i) ... formatted = format_c_number_range_width(i)
... expected = '{:04d}'.format(i) ... expected = '{n:04d}'.format(n=i)
... assert formatted == expected, "%r != %r" % (formatted, expected) ... assert formatted == expected, "%r != %r" % (formatted, expected)
""" """
return f'{n:04}' return f'{n:04}'
...@@ -177,7 +177,7 @@ def format_c_number_range_width0(int n): ...@@ -177,7 +177,7 @@ def format_c_number_range_width0(int n):
""" """
>>> for i in range(-100, 101): >>> for i in range(-100, 101):
... formatted = format_c_number_range_width0(i) ... formatted = format_c_number_range_width0(i)
... expected = '{:00d}'.format(i) ... expected = '{n:00d}'.format(n=i)
... assert formatted == expected, "%r != %r" % (formatted, expected) ... assert formatted == expected, "%r != %r" % (formatted, expected)
""" """
return f'{n:00}' return f'{n:00}'
...@@ -187,7 +187,7 @@ def format_c_number_range_width1(int n): ...@@ -187,7 +187,7 @@ def format_c_number_range_width1(int n):
""" """
>>> for i in range(-100, 101): >>> for i in range(-100, 101):
... formatted = format_c_number_range_width1(i) ... formatted = format_c_number_range_width1(i)
... expected = '{:01d}'.format(i) ... expected = '{n:01d}'.format(n=i)
... assert formatted == expected, "%r != %r" % (formatted, expected) ... assert formatted == expected, "%r != %r" % (formatted, expected)
""" """
return f'{n:01}' return f'{n:01}'
...@@ -197,7 +197,7 @@ def format_c_number_range_width_m4(int n): ...@@ -197,7 +197,7 @@ def format_c_number_range_width_m4(int n):
""" """
>>> for i in range(-100, 101): >>> for i in range(-100, 101):
... formatted = format_c_number_range_width_m4(i) ... formatted = format_c_number_range_width_m4(i)
... expected = '{:-4d}'.format(i) ... expected = '{n:-4d}'.format(n=i)
... assert formatted == expected, "%r != %r" % (formatted, expected) ... assert formatted == expected, "%r != %r" % (formatted, expected)
""" """
return f'{n:-4}' return f'{n:-4}'
......
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