Passing factory=f is syntactic sugar for passing default=Factory(f).
(self)
| 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 | """ |