PythonExtra/tests/cpydiff/core_fstring_repr.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
335 B
Python
Raw Permalink Normal View History

"""
categories: Core
description: f-strings don't support the !r, !s, and !a conversions
cause: MicroPython is optimised for code space.
workaround: Use repr(), str(), and ascii() explictly.
"""
class X:
def __repr__(self):
return "repr"
def __str__(self):
return "str"
print(f"{X()!r}")
print(f"{X()!s}")