1
0
Fork 0
mirror of synced 2025-07-04 04:17:29 +02:00

Some arguments are mutually exclusives

This commit is contained in:
jvoisin 2018-05-16 00:07:04 +02:00
parent 7b0a27ce76
commit be6d32afa8
2 changed files with 9 additions and 3 deletions

View file

@ -8,12 +8,12 @@ class TestHelp(unittest.TestCase):
def test_help(self):
proc = subprocess.Popen(['./main.py', '--help'], stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'usage: main.py [-h] [-v] [-c] [-l] [-s] [-L] [files [files ...]]', stdout)
self.assertIn(b'usage: main.py [-h] [-v] [-l] [-c | -s | -L] [files [files ...]]', stdout)
def test_no_arg(self):
proc = subprocess.Popen(['./main.py'], stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'usage: main.py [-h] [-v] [-c] [-l] [-s] [-L] [files [files ...]]', stdout)
self.assertIn(b'usage: main.py [-h] [-v] [-l] [-c | -s | -L] [files [files ...]]', stdout)
class TestVersion(unittest.TestCase):
@ -23,6 +23,12 @@ class TestVersion(unittest.TestCase):
self.assertTrue(stdout.startswith(b'MAT2 '))
class TestExclusiveArgs(unittest.TestCase):
def test_version(self):
proc = subprocess.Popen(['./main.py', '-s', '-c'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = proc.communicate()
self.assertIn(b'main.py: error: argument -c/--check: not allowed with argument -s/--show', stderr)
class TestReturnValue(unittest.TestCase):
def test_nonzero(self):