MCPcopy Index your code
hub / github.com/pyinvoke/invoke / clones_noninitial_contexts

Method clones_noninitial_contexts

tests/parser_parser.py:157–170  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

155 assert a2.value is True
156
157 def clones_noninitial_contexts(self) -> None:
158 a = Argument("foo")
159 assert a.value is None
160 c = Context(name="mytask", args=(a,))
161 p = Parser(contexts=(c,))
162 assert p.contexts["mytask"] is c
163 r = p.parse_argv(["mytask", "--foo", "val"])
164 assert p.contexts["mytask"] is c
165 c2 = r[0]
166 assert c2 is not c
167 a2 = c2.args["foo"]
168 assert a2 is not a
169 assert a.value is None
170 assert a2.value == "val"
171
172 class parsing_errors:
173 def setup_method(self) -> None:

Callers

nothing calls this directly

Calls 4

parse_argvMethod · 0.95
ArgumentClass · 0.90
ParserClass · 0.90
ContextClass · 0.85

Tested by

no test coverage detected