Skip to content
Snippets Groups Projects
Commit bd7accf6 authored by Bienchen's avatar Bienchen
Browse files

Testing missing arguments

parent c49c60a9
No related branches found
No related tags found
No related merge requests found
...@@ -77,6 +77,32 @@ class PM3ArgParseTests(unittest.TestCase): ...@@ -77,6 +77,32 @@ class PM3ArgParseTests(unittest.TestCase):
'test.\n\noptional arguments:\n -h, --help show '+ 'test.\n\noptional arguments:\n -h, --help show '+
'this help message and exit']) 'this help message and exit'])
def testAddAlignmentNoTrgArg(self):
# check failure on missing trg: argument
parser = pm3argparse.PM3ArgumentParser(__doc__, action=False)
parser.AddAlignment()
parser.AssembleParser()
with self.assertRaises(SystemExit) as ecd:
parser.Parse(['--fasta', 'data/fasta/alignment.fas'])
self.assertEqual(ecd.exception.code, 2)
self.assertEqual(self.log.messages['ERROR'],
['usage: test_pm3argparse.py [-h] [-f trg:<NAME> '+
'<FILE>]', 'test_pm3argparse.py: error: argument '+
'-f/--fasta: expected 2 argument(s)'])
def testAddAlignmentNoFileArg(self):
# check failure on missing file argument
parser = pm3argparse.PM3ArgumentParser(__doc__, action=False)
parser.AddAlignment()
parser.AssembleParser()
with self.assertRaises(SystemExit) as ecd:
parser.Parse(['--fasta', 'trg:target'])
self.assertEqual(ecd.exception.code, 2)
self.assertEqual(self.log.messages['ERROR'],
['usage: test_pm3argparse.py [-h] [-f trg:<NAME> '+
'<FILE>]', 'test_pm3argparse.py: error: argument '+
'-f/--fasta: expected 2 argument(s)'])
def testAddAlignemntNoTrgPfx(self): def testAddAlignemntNoTrgPfx(self):
# checking that we fail on missing 'trg:' prefix for arguments of # checking that we fail on missing 'trg:' prefix for arguments of
# --fasta # --fasta
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment