Add unit test for handling getopt error.

This commit is contained in:
Baizley 2019-12-20 21:16:41 +01:00 committed by Nick Hall
parent ba09cda0d0
commit 178d3ecb00

View File

@ -68,5 +68,20 @@ class TestArgParser(unittest.TestCase):
ap = self.create_parser()
assert not ap.auto_accept
def test_exception(self):
argument_parser = self.create_parser("-O")
expected_errors = [(
'Error parsing the arguments',
'option -O requires argument\n'
'Error parsing the arguments: [ -O ] \n'
'Type gramps --help for an overview of commands, or read the manual pages.'
)]
self.assertEqual(
expected_errors,
argument_parser.errors
)
if __name__ == "__main__":
unittest.main()