summaryrefslogtreecommitdiff
path: root/tests/test_arg_parser.py
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2023-02-18 20:37:30 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2023-02-18 20:37:30 -0600
commitc4bafa375d8aa387201a6f622aff3d22f1753b31 (patch)
tree8c17fb9aec5c6e930c13f312a561bf0be09e5e55 /tests/test_arg_parser.py
parent0259f32e880041e3fbfd7bfba2698723c71700c8 (diff)
add simple test feature
Diffstat (limited to 'tests/test_arg_parser.py')
-rw-r--r--tests/test_arg_parser.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_arg_parser.py b/tests/test_arg_parser.py
new file mode 100644
index 0000000..45263ce
--- /dev/null
+++ b/tests/test_arg_parser.py
@@ -0,0 +1,16 @@
+import pytest
+from argparse import ArgumentParser
+
+
+@pytest.mark.parametrize('args, arg_name, exp_result', [
+ (['--version'], 'version', True),
+ (['-v'], 'version', True),
+ (['--config', 'value'], 'config', 'value'),
+ (['-c', 'value'], 'config', 'value'),
+])
+def test_individual_args(args: list[str],
+ arg_name: str,
+ exp_result: str | bool,
+ arg_parser: ArgumentParser) -> None:
+ parsed_args: dict[str, str | bool] = vars(arg_parser.parse_args(args))
+ assert parsed_args[arg_name] == exp_result