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

Method test_factory_sugar

tests/test_make.py:921–930  ·  view source on GitHub ↗

Passing factory=f is syntactic sugar for passing default=Factory(f).

(self)

Source from the content-addressed store, hash-verified

919 assert not isinstance(x, _CountingAttr)
920
921 def test_factory_sugar(self):
922 """
923 Passing factory=f is syntactic sugar for passing default=Factory(f).
924 """
925
926 @attr.s
927 class C:
928 x = attr.ib(factory=list)
929
930 assert Factory(list) == attr.fields(C).x.default
931
932 def test_sugar_factory_mutex(self):
933 """

Callers

nothing calls this directly

Calls 1

FactoryClass · 0.90

Tested by

no test coverage detected