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

Method test_convert_property

tests/test_make.py:1724–1740  ·  view source on GitHub ↗

Property tests for attributes using converter.

(self, val, init)

Source from the content-addressed store, hash-verified

1722
1723 @given(integers(), booleans())
1724 def test_convert_property(self, val, init):
1725 """
1726 Property tests for attributes using converter.
1727 """
1728 C = make_class(
1729 "C",
1730 {
1731 "y": attr.ib(),
1732 "x": attr.ib(
1733 init=init, default=val, converter=lambda v: v + 1
1734 ),
1735 },
1736 )
1737 c = C(2)
1738
1739 assert c.x == val + 1
1740 assert c.y == 2
1741
1742 @given(integers(), booleans())
1743 def test_converter_factory_property(self, val, init):

Callers

nothing calls this directly

Calls 2

make_classFunction · 0.90
CClass · 0.70

Tested by

no test coverage detected