| 18 | |
| 19 | |
| 20 | def 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 | |
| 50 | def test_option_name(): |