summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_fstring.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_fstring.py')
-rw-r--r--Lib/test/test_fstring.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py
index 3ba2f94..031b94d 100644
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -764,6 +764,16 @@ x = (
"""f'{"s"!{"r"}}'""",
])
+ def test_custom_format_specifier(self):
+ class CustomFormat:
+ def __format__(self, format_spec):
+ return format_spec
+
+ self.assertEqual(f'{CustomFormat():\n}', '\n')
+ self.assertEqual(f'{CustomFormat():\u2603}', '☃')
+ with self.assertWarns(SyntaxWarning):
+ exec('f"{F():¯\_(ツ)_/¯}"', {'F': CustomFormat})
+
def test_side_effect_order(self):
class X:
def __init__(self):