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

Method test_helper_fields_exception

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

Source from the content-addressed store, hash-verified

1597 self.assertEqual(fields(C), fields(C(0, 0.0)))
1598
1599 def test_helper_fields_exception(self):
1600 # Check that TypeError is raised if not passed a dataclass or
1601 # instance.
1602 with self.assertRaisesRegex(TypeError, 'dataclass type or instance'):
1603 fields(0)
1604
1605 class C: pass
1606 with self.assertRaisesRegex(TypeError, 'dataclass type or instance'):
1607 fields(C)
1608 with self.assertRaisesRegex(TypeError, 'dataclass type or instance'):
1609 fields(C())
1610
1611 def test_clean_traceback_from_fields_exception(self):
1612 stdout = io.StringIO()

Callers

nothing calls this directly

Calls 3

assertRaisesRegexMethod · 0.95
fieldsFunction · 0.85
CClass · 0.70

Tested by

no test coverage detected