MCPcopy
hub / github.com/python-attrs/attrs / test_pre_init

Method test_pre_init

tests/test_make.py:725–737  ·  view source on GitHub ↗

Verify that __attrs_pre_init__ gets called if defined.

(self)

Source from the content-addressed store, hash-verified

723
724 @pytest.mark.usefixtures("with_and_without_validation")
725 def test_pre_init(self):
726 """
727 Verify that __attrs_pre_init__ gets called if defined.
728 """
729
730 @attr.s
731 class C:
732 def __attrs_pre_init__(self2):
733 self2.z = 30
734
735 c = C()
736
737 assert 30 == getattr(c, "z", None)
738
739 @pytest.mark.usefixtures("with_and_without_validation")
740 def test_pre_init_args(self):

Callers

nothing calls this directly

Calls 1

CClass · 0.70

Tested by

no test coverage detected