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

Method test_dicts

tests/test_funcs.py:185–192  ·  view source on GitHub ↗

If recurse is True, also recurse into dicts.

(self, C, dict_factory)

Source from the content-addressed store, hash-verified

183
184 @given(st.sampled_from(MAPPING_TYPES))
185 def test_dicts(self, C, dict_factory):
186 """
187 If recurse is True, also recurse into dicts.
188 """
189 res = asdict(C(1, {"a": C(4, 5)}), dict_factory=dict_factory)
190
191 assert {"x": 1, "y": {"a": {"x": 4, "y": 5}}} == res
192 assert isinstance(res, dict_factory)
193
194 @given(simple_classes(private_attrs=False), st.sampled_from(MAPPING_TYPES))
195 def test_roundtrip(self, cls, dict_class):

Callers

nothing calls this directly

Calls 2

asdictFunction · 0.90
CClass · 0.70

Tested by

no test coverage detected