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

Method test_private

tests/test_funcs.py:740–755  ·  view source on GitHub ↗

evolve() acts as `__init__` with regards to private attributes.

(self)

Source from the content-addressed store, hash-verified

738 assert m.startswith("'a' must be <class 'int'>")
739
740 def test_private(self):
741 """
742 evolve() acts as `__init__` with regards to private attributes.
743 """
744
745 @attr.s
746 class C:
747 _a = attr.ib()
748
749 assert evolve(C(1), a=2)._a == 2
750
751 with pytest.raises(TypeError):
752 evolve(C(1), _a=2)
753
754 with pytest.raises(TypeError):
755 evolve(C(1), a=3, _a=2)
756
757 def test_non_init_attrs(self):
758 """

Callers

nothing calls this directly

Calls 2

evolveFunction · 0.90
CClass · 0.70

Tested by

no test coverage detected