Skip to content

Commit

Permalink
✅ update
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Feb 24, 2024
1 parent c09c017 commit 1fb4420
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ dev = [
]

[tool.pdm.scripts]
test = "pytest -v --ignore entry_test.py"
test = "pytest -v -W ignore --ignore entry_test.py"
benchmark = "python benchmark.py"
deps = "pydeps -o alconna.svg ./src/arclet/alconna --max-bacon=4 --cluster --keep-target-cluster --rmprefix alconna. "

Expand Down
8 changes: 4 additions & 4 deletions tests/analyser_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ def test_filter_out():


def test_preprocessor():
argv_config(preprocessors={float: int})
argv_config(preprocessors={list: len})
ana1 = Alconna("ana1", Args["bar", int])
assert ana1.parse(["ana1", 123.06]).matched is True
assert ana1.parse(["ana1", 123.06]).bar == 123
assert ana1.parse(["ana1", [1, 2, 3]]).matched is True
assert ana1.parse(["ana1", [1, 2, 3]]).bar == 3
argv_config(preprocessors={})
ana1_1 = Alconna("ana1", Args["bar", int])
assert ana1_1.parse(["ana1", 123.06]).matched is False
assert ana1_1.parse(["ana1", [1, 2, 3]]).matched is False


def test_with_set_unit():
Expand Down
9 changes: 0 additions & 9 deletions tests/args_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@
from devtool import analyse_args


def test_kwargs_create():
arg = Args(pak=str, upgrade=str)
assert arg == Args.pak[str]["upgrade", str]
assert analyse_args(arg, ["arclet-alconna bar"]) == {
"pak": "arclet-alconna",
"upgrade": "bar",
}


def test_magic_create():
arg1 = Args["round", float]["test", bool]["aaa", str]
assert len(arg1) == 3
Expand Down
2 changes: 1 addition & 1 deletion tests/core_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ def test_tips():
assert core27.parse("core27 1 1").matched
assert str(core27.parse("core27 3 1").error_info) == "参数arg必须是1或2哦,不能是3"
assert str(core27.parse("core27 1").error_info) == "缺少了arg参数哦"
assert str(core27.parse("core27 1 3").error_info) == "参数 3 不正确"
assert str(core27.parse("core27 1 3").error_info) in ("参数 '3' 不正确, 其应该符合 '1|2'", "参数 '3' 不正确, 其应该符合 '2|1'")
assert str(core27.parse("core27").error_info) == "参数 arg1 丢失"


Expand Down

0 comments on commit 1fb4420

Please sign in to comment.