From be6d32afa830fd5b4e7dee5b649c83523a59e04d Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 16 May 2018 00:07:04 +0200 Subject: Some arguments are mutually exclusives --- tests/test_climat2.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'tests/test_climat2.py') diff --git a/tests/test_climat2.py b/tests/test_climat2.py index 67b56eb..864ee0d 100644 --- a/tests/test_climat2.py +++ b/tests/test_climat2.py @@ -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): -- cgit v1.3