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

Method test_wrapped_annotation

tests/test_converters.py:278–299  ·  view source on GitHub ↗

The return type of the wrapped converter is copied into its __call__ and ultimately into pipe's wrapped converter.

(self)

Source from the content-addressed store, hash-verified

276 assert o is pipe()(o)
277
278 def test_wrapped_annotation(self):
279 """
280 The return type of the wrapped converter is copied into its __call__
281 and ultimately into pipe's wrapped converter.
282 """
283
284 def last(value) -> bool:
285 return bool(value)
286
287 @attr.s
288 class C:
289 x = attr.ib(converter=[Converter(int), Converter(last)])
290
291 i = C(5)
292
293 assert True is i.x
294 assert (
295 bool
296 is _AnnotationExtractor(
297 attr.fields(C).x.converter.__call__
298 ).get_return_type()
299 )
300
301
302class TestOptionalPipe:

Callers

nothing calls this directly

Calls 3

get_return_typeMethod · 0.80
CClass · 0.70

Tested by

no test coverage detected