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

Method test_init_var_no_default

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

Source from the content-addressed store, hash-verified

1256 self.assertEqual(c.t, 3000)
1257
1258 def test_init_var_no_default(self):
1259 # If an InitVar has no default value, it should not be set on the class.
1260 @dataclass
1261 class C:
1262 x: InitVar[int]
1263
1264 self.assertNotIn('x', C.__dict__)
1265
1266 def test_init_var_default_factory(self):
1267 # It makes no sense for an InitVar to have a default factory. When

Callers

nothing calls this directly

Calls 1

assertNotInMethod · 0.95

Tested by

no test coverage detected