PythonExtra/tests/basics/string_format_cp310.py
Jeff Epler 037b2c72a1 py/objstr: Support '{:08}'.format("Jan") like Python 3.10.
The new test has an .exp file, because it is not compatible with Python 3.9
and lower.

See CPython version of the issue at https://bugs.python.org/issue27772

Signed-off-by: Jeff Epler <jepler@gmail.com>
2022-01-19 15:34:32 +11:00

10 lines
228 B
Python

# Python 3.10+ functionality test for {} format string
def test(fmt, *args):
print('{:8s}'.format(fmt) + '>' + fmt.format(*args) + '<')
test("{:0s}", "ab")
test("{:06s}", "ab")
test("{:<06s}", "ab")
test("{:>06s}", "ab")