MCPcopy Index your code
hub / github.com/python/cpython / test_custom_format_specifier

Method test_custom_format_specifier

Lib/test/test_fstring.py:847–855  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

845 ])
846
847 def test_custom_format_specifier(self):
848 class CustomFormat:
849 def __format__(self, format_spec):
850 return format_spec
851
852 self.assertEqual(f'{CustomFormat():\n}', '\n')
853 self.assertEqual(f'{CustomFormat():\u2603}', '☃')
854 with self.assertWarns(SyntaxWarning):
855 exec(r'f"{F():¯\_(ツ)_/¯}"', {'F': CustomFormat})
856
857 def test_side_effect_order(self):
858 class X:

Callers

nothing calls this directly

Calls 3

assertEqualMethod · 0.95
assertWarnsMethod · 0.95
CustomFormatClass · 0.85

Tested by

no test coverage detected