If `init` is False but a Factory is specified, don't allow passing that argument but initialize it anyway.
(self, slots, frozen)
| 763 | |
| 764 | @given(booleans(), booleans()) |
| 765 | def test_no_init_default(self, slots, frozen): |
| 766 | """ |
| 767 | If `init` is False but a Factory is specified, don't allow passing that |
| 768 | argument but initialize it anyway. |
| 769 | """ |
| 770 | C = make_class( |
| 771 | "C", |
| 772 | { |
| 773 | "_a": attr.ib(init=False, default=42), |
| 774 | "_b": attr.ib(init=False, default=Factory(list)), |
| 775 | "c": attr.ib(), |
| 776 | }, |
| 777 | slots=slots, |
| 778 | frozen=frozen, |
| 779 | ) |
| 780 | with pytest.raises(TypeError): |
| 781 | C(a=1, c=2) |
| 782 | with pytest.raises(TypeError): |
| 783 | C(b=1, c=2) |
| 784 | |
| 785 | i = C(23) |
| 786 | assert (42, [], 23) == (i._a, i._b, i.c) |
| 787 | |
| 788 | @given(booleans(), booleans()) |
| 789 | def test_no_init_order(self, slots, frozen): |
nothing calls this directly
no test coverage detected