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

Method test_converter

tests/test_make.py:1671–1681  ·  view source on GitHub ↗

Return value of converter is used as the attribute's value.

(self)

Source from the content-addressed store, hash-verified

1669 """
1670
1671 def test_converter(self):
1672 """
1673 Return value of converter is used as the attribute's value.
1674 """
1675 C = make_class(
1676 "C", {"x": attr.ib(converter=lambda v: v + 1), "y": attr.ib()}
1677 )
1678 c = C(1, 2)
1679
1680 assert c.x == 2
1681 assert c.y == 2
1682
1683 def test_converter_wrapped_takes_self(self):
1684 """

Callers

nothing calls this directly

Calls 2

make_classFunction · 0.90
CClass · 0.70

Tested by

no test coverage detected