MCPcopy
hub / github.com/pallets/click / test_with_resource

Function test_with_resource

tests/test_context.py:522–535  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

520
521
522def test_with_resource():
523 @contextmanager
524 def manager():
525 val = [1]
526 yield val
527 val[0] = 0
528
529 ctx = click.Context(click.Command("test"))
530
531 with ctx.scope():
532 rv = ctx.with_resource(manager())
533 assert rv[0] == 1
534
535 assert rv == [0]
536
537
538def test_with_resource_exception() -> None:

Callers

nothing calls this directly

Calls 3

scopeMethod · 0.95
with_resourceMethod · 0.95
managerFunction · 0.85

Tested by

no test coverage detected