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

Method test_roundtrip

tests/test_funcs.py:430–441  ·  view source on GitHub ↗

Test dumping to tuple and back for Hypothesis-generated classes.

(self, cls, tuple_class)

Source from the content-addressed store, hash-verified

428
429 @given(simple_classes(), st.sampled_from(SEQUENCE_TYPES))
430 def test_roundtrip(self, cls, tuple_class):
431 """
432 Test dumping to tuple and back for Hypothesis-generated classes.
433 """
434 instance = cls()
435 tuple_instance = astuple(instance, tuple_factory=tuple_class)
436
437 assert isinstance(tuple_instance, tuple_class)
438
439 roundtrip_instance = cls(*tuple_instance)
440
441 assert instance == roundtrip_instance
442
443 @given(set_type=st.sampled_from((set, frozenset)))
444 def test_sets_no_retain(self, C, set_type):

Callers

nothing calls this directly

Calls 1

astupleFunction · 0.90

Tested by

no test coverage detected