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

Method assert_proper_tuple_class

tests/test_funcs.py:330–336  ·  tests/test_funcs.py::TestAsTuple.assert_proper_tuple_class
(obj, obj_tuple)

Source from the content-addressed store, hash-verified

328 obj_tuple = astuple(obj, tuple_factory=tuple_class)
329
330 def assert_proper_tuple_class(obj, obj_tuple):
331 assert isinstance(obj_tuple, tuple_class)
332 for index, field in enumerate(fields(obj.__class__)):
333 field_val = getattr(obj, field.name)
334 if has(field_val.__class__):
335 class="cm"># This field holds a class, recurse the assertions.
336 assert_proper_tuple_class(field_val, obj_tuple[index])
337
338 assert_proper_tuple_class(obj, obj_tuple)
339

Callers

nothing calls this directly

Calls 2

fieldsFunction · 0.90
hasFunction · 0.90

Tested by

no test coverage detected