MCPcopy
hub / github.com/docopt/docopt / test_either_match

Function test_either_match

test_docopt.py:209–223  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

207
208
209def test_either_match():
210 assert Either(Option('-a'), Option('-b')).match(
211 [Option('-a')]) == (True, [], [Option('-a')])
212 assert Either(Option('-a'), Option('-b')).match(
213 [Option('-a'), Option('-b')]) == \
214 (True, [Option('-b')], [Option('-a')])
215 assert Either(Option('-a'), Option('-b')).match(
216 [Option('-x')]) == (False, [Option('-x')], [])
217 assert Either(Option('-a'), Option('-b'), Option('-c')).match(
218 [Option('-x'), Option('-b')]) == \
219 (True, [Option('-x')], [Option('-b')])
220 assert Either(Argument('M'),
221 Required(Argument('N'), Argument('M'))).match(
222 [Argument(None, 1), Argument(None, 2)]) == \
223 (True, [], [Argument('N', 1), Argument('M', 2)])
224
225
226def test_one_or_more_match():

Callers

nothing calls this directly

Calls 5

EitherClass · 0.90
OptionClass · 0.90
ArgumentClass · 0.90
RequiredClass · 0.90
matchMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…