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

Method test_programmatic

tests/test_functional.py:187–222  ·  view source on GitHub ↗

`attr.make_class` works.

(self, slots, frozen)

Source from the content-addressed store, hash-verified

185
186 @given(booleans(), booleans())
187 def test_programmatic(self, slots, frozen):
188 """
189 `attr.make_class` works.
190 """
191 PC = attr.make_class("PC", ["a", "b"], slots=slots, frozen=frozen)
192
193 assert (
194 Attribute(
195 name="a",
196 alias="a",
197 default=NOTHING,
198 validator=None,
199 repr=True,
200 cmp=None,
201 eq=True,
202 order=True,
203 hash=None,
204 init=True,
205 inherited=False,
206 alias_is_default=True,
207 ),
208 Attribute(
209 name="b",
210 alias="b",
211 default=NOTHING,
212 validator=None,
213 repr=True,
214 cmp=None,
215 eq=True,
216 order=True,
217 hash=None,
218 init=True,
219 inherited=False,
220 alias_is_default=True,
221 ),
222 ) == attr.fields(PC)
223
224 @pytest.mark.parametrize("cls", [Sub, SubSlots])
225 def test_subclassing_with_extra_attrs(self, cls):

Callers

nothing calls this directly

Calls 1

AttributeClass · 0.90

Tested by

no test coverage detected