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

Method test_side_effect_order

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

Source from the content-addressed store, hash-verified

855 exec(r'f"{F():¯\_(ツ)_/¯}"', {'F': CustomFormat})
856
857 def test_side_effect_order(self):
858 class X:
859 def __init__(self):
860 self.i = 0
861 def __format__(self, spec):
862 self.i += 1
863 return str(self.i)
864
865 x = X()
866 self.assertEqual(f'{x} {x}', '1 2')
867
868 def test_missing_expression(self):
869 self.assertAllRaise(SyntaxError,

Callers

nothing calls this directly

Calls 2

assertEqualMethod · 0.95
XClass · 0.70

Tested by

no test coverage detected