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

Method test_instance

tests/test_converters.py:323–341  ·  view source on GitHub ↗

Should work when set as an attrib.

(self)

Source from the content-addressed store, hash-verified

321 )
322
323 def test_instance(self):
324 """
325 Should work when set as an attrib.
326 """
327
328 @attr.s
329 class C:
330 x = attrib(
331 converter=optional(pipe(str, Converter(to_bool), bool)),
332 default=None,
333 )
334
335 c1 = C()
336
337 assert None is c1.x
338
339 c2 = C("True")
340
341 assert True is c2.x
342
343
344class TestToBool:

Callers

nothing calls this directly

Calls 1

CClass · 0.70

Tested by

no test coverage detected