MCPcopy Index your code
hub / github.com/docopt/docopt / test_optional_match

Function test_optional_match

test_docopt.py:180–196  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

178
179
180def test_optional_match():
181 assert Optional(Option('-a')).match([Option('-a')]) == \
182 (True, [], [Option('-a')])
183 assert Optional(Option('-a')).match([]) == (True, [], [])
184 assert Optional(Option('-a')).match([Option('-x')]) == \
185 (True, [Option('-x')], [])
186 assert Optional(Option('-a'), Option('-b')).match([Option('-a')]) == \
187 (True, [], [Option('-a')])
188 assert Optional(Option('-a'), Option('-b')).match([Option('-b')]) == \
189 (True, [], [Option('-b')])
190 assert Optional(Option('-a'), Option('-b')).match([Option('-x')]) == \
191 (True, [Option('-x')], [])
192 assert Optional(Argument('N')).match([Argument(None, 9)]) == \
193 (True, [], [Argument('N', 9)])
194 assert Optional(Option('-a'), Option('-b')).match(
195 [Option('-b'), Option('-x'), Option('-a')]) == \
196 (True, [Option('-x')], [Option('-a'), Option('-b')])
197
198
199def test_required_match():

Callers

nothing calls this directly

Calls 4

OptionalClass · 0.90
OptionClass · 0.90
ArgumentClass · 0.90
matchMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…