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

Function test_option

test_docopt.py:20–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18
19
20def test_option():
21 assert Option.parse('-h') == Option('-h', None)
22 assert Option.parse('--help') == Option(None, '--help')
23 assert Option.parse('-h --help') == Option('-h', '--help')
24 assert Option.parse('-h, --help') == Option('-h', '--help')
25
26 assert Option.parse('-h TOPIC') == Option('-h', None, 1)
27 assert Option.parse('--help TOPIC') == Option(None, '--help', 1)
28 assert Option.parse('-h TOPIC --help TOPIC') == Option('-h', '--help', 1)
29 assert Option.parse('-h TOPIC, --help TOPIC') == Option('-h', '--help', 1)
30 assert Option.parse('-h TOPIC, --help=TOPIC') == Option('-h', '--help', 1)
31
32 assert Option.parse('-h Description...') == Option('-h', None)
33 assert Option.parse('-h --help Description...') == Option('-h', '--help')
34 assert Option.parse('-h TOPIC Description...') == Option('-h', None, 1)
35
36 assert Option.parse(' -h') == Option('-h', None)
37
38 assert Option.parse('-h TOPIC Descripton... [default: 2]') == \
39 Option('-h', None, 1, '2')
40 assert Option.parse('-h TOPIC Descripton... [default: topic-1]') == \
41 Option('-h', None, 1, 'topic-1')
42 assert Option.parse('--help=TOPIC ... [default: 3.14]') == \
43 Option(None, '--help', 1, '3.14')
44 assert Option.parse('-h, --help=DIR ... [default: ./]') == \
45 Option('-h', '--help', 1, "./")
46 assert Option.parse('-h TOPIC Descripton... [dEfAuLt: 2]') == \
47 Option('-h', None, 1, '2')
48
49
50def test_option_name():

Callers

nothing calls this directly

Calls 2

OptionClass · 0.90
parseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…