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

Method test_factory_takes_self

tests/test_dunders.py:847–862  ·  view source on GitHub ↗

If takes_self on factories is True, self is passed.

(self)

Source from the content-addressed store, hash-verified

845 assert isinstance(i.b, D)
846
847 def test_factory_takes_self(self):
848 """
849 If takes_self on factories is True, self is passed.
850 """
851 C = make_class(
852 "C",
853 {
854 "x": attr.ib(
855 default=Factory((lambda self: self), takes_self=True)
856 )
857 },
858 )
859
860 i = C()
861
862 assert i is i.x
863
864 def test_factory_hashable(self):
865 """

Callers

nothing calls this directly

Calls 3

make_classFunction · 0.90
FactoryClass · 0.90
CClass · 0.70

Tested by

no test coverage detected