Last active
August 24, 2017 12:58
-
-
Save marceloslacerda/8fe571c3cc26634819d13f65980fa8aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import docopt | |
class DocoptTestCase(unittest.TestCase): | |
def test_single_optional(self): | |
docopt.docopt(""" | |
test command | |
Usage: test [--verbose] | |
Options: | |
--verbose print something | |
""") | |
self.assertTrue(True) | |
if __name__ == '__main__': | |
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python tdocopt.py | |
E | |
====================================================================== | |
ERROR: test_single_optional (__main__.DocoptTestCase) | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "tdocopt.py", line 14, in test_single_optional | |
""") | |
File "/home/msl09/.virtualenvs/telegram/lib/python3.6/site-packages/docopt.py", line 560, in docopt | |
pattern = parse_pattern(formal_usage(DocoptExit.usage), options) | |
File "/home/msl09/.virtualenvs/telegram/lib/python3.6/site-packages/docopt.py", line 373, in parse_pattern | |
result = parse_expr(tokens, options) | |
File "/home/msl09/.virtualenvs/telegram/lib/python3.6/site-packages/docopt.py", line 381, in parse_expr | |
seq = parse_seq(tokens, options) | |
File "/home/msl09/.virtualenvs/telegram/lib/python3.6/site-packages/docopt.py", line 396, in parse_seq | |
atom = parse_atom(tokens, options) | |
File "/home/msl09/.virtualenvs/telegram/lib/python3.6/site-packages/docopt.py", line 413, in parse_atom | |
result = pattern(*parse_expr(tokens, options)) | |
File "/home/msl09/.virtualenvs/telegram/lib/python3.6/site-packages/docopt.py", line 381, in parse_expr | |
seq = parse_seq(tokens, options) | |
File "/home/msl09/.virtualenvs/telegram/lib/python3.6/site-packages/docopt.py", line 396, in parse_seq | |
atom = parse_atom(tokens, options) | |
File "/home/msl09/.virtualenvs/telegram/lib/python3.6/site-packages/docopt.py", line 415, in parse_atom | |
raise tokens.error("unmatched '%s'" % token) | |
docopt.DocoptLanguageError: unmatched '[' | |
---------------------------------------------------------------------- | |
Ran 1 test in 0.002s | |
FAILED (errors=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment