Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
mat2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tails
mat2
Commits
be6d32af
Commit
be6d32af
authored
6 years ago
by
Julien (jvoisin) Voisin
Browse files
Options
Downloads
Patches
Plain Diff
Some arguments are mutually exclusives
parent
7b0a27ce
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
main.py
+1
-1
1 addition, 1 deletion
main.py
tests/test_climat2.py
+8
-2
8 additions, 2 deletions
tests/test_climat2.py
with
9 additions
and
3 deletions
main.py
+
1
−
1
View file @
be6d32af
...
...
@@ -30,7 +30,7 @@ def create_arg_parser():
parser
.
add_argument
(
'
-l
'
,
'
--list
'
,
action
=
'
store_true
'
,
help
=
'
list all supported fileformats
'
)
info
=
parser
.
add_
argument_group
(
'
Information
'
)
info
=
parser
.
add_
mutually_exclusive_group
(
)
info
.
add_argument
(
'
-c
'
,
'
--check
'
,
action
=
'
store_true
'
,
help
=
'
check if a file is free of harmful metadatas
'
)
info
.
add_argument
(
'
-s
'
,
'
--show
'
,
action
=
'
store_true
'
,
...
...
This diff is collapsed.
Click to expand it.
tests/test_climat2.py
+
8
−
2
View file @
be6d32af
...
...
@@ -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
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment