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

Method test_field_repr

Lib/test/test_dataclasses/__init__.py:67–79  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

65 x: int = field(default=1, default_factory=int)
66
67 def test_field_repr(self):
68 int_field = field(default=1, init=True, repr=False, doc='Docstring')
69 int_field.name = "id"
70 repr_output = repr(int_field)
71 expected_output = "Field(name='id',type=None," \
72 f"default=1,default_factory={MISSING!r}," \
73 "init=True,repr=False,hash=None," \
74 "compare=True,metadata=frozendict()," \
75 f"kw_only={MISSING!r}," \
76 "doc='Docstring'," \
77 "_field_type=None)"
78
79 self.assertEqual(repr_output, expected_output)
80
81 def test_field_recursive_repr(self):
82 rec_field = field()

Callers

nothing calls this directly

Calls 2

assertEqualMethod · 0.95
fieldFunction · 0.85

Tested by

no test coverage detected