MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_custom_format_specifier

Method test_custom_format_specifier

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

Source from the content-addressed store, hash-verified

851 ])
852
853 def test_custom_format_specifier(self):
854 class CustomFormat:
855 def __format__(self, format_spec):
856 return format_spec
857
858 self.assertEqual(f'{CustomFormat():\n}', '\n')
859 self.assertEqual(f'{CustomFormat():\u2603}', '☃')
860 with self.assertWarns(SyntaxWarning):
861 exec(r'f"{F():¯\_(ツ)_/¯}"', {'F': CustomFormat})
862
863 def test_side_effect_order(self):
864 class X:

Callers

nothing calls this directly

Calls 4

assertEqualMethod · 0.95
assertWarnsMethod · 0.95
CustomFormatClass · 0.85
execFunction · 0.50

Tested by

no test coverage detected