Skip to content

Commit ace59c3

Browse files
arilloidgitdevjin
authored andcommitted
test handling of invalid CLI flags in argument parser
--version in .toml changed
1 parent adfe9bc commit ace59c3

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "code-mage"
3-
version = "0.1.0"
3+
version = "0.9.0"
44
description = ""
55
authors = ["gitdevjin <[email protected]>"]
66
readme = "README.md"

tests/test_argsParser.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,12 @@ def test_arg_parser_token_usage_option_short(mock_config):
113113
with patch("sys.argv", ["code_mage.py", "-t"]):
114114
args = arg_parser(mock_config)
115115
assert args.token_usage is True
116+
117+
118+
# Test invalid flag argument option
119+
def test_arg_parser_invalid_option():
120+
with patch("sys.argv", ["code_mage.py", "--invalid"]):
121+
with pytest.raises(SystemExit) as excinfo:
122+
arg_parser({})
123+
assert excinfo.type is SystemExit
124+
assert excinfo.value.code != 0

0 commit comments

Comments
 (0)