v2.6.0 (#524)
Co-authored-by: Clément Drouin <clement.drouin@mistral.ai> Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai> Co-authored-by: Gauthier Guinet <43207538+Gguinet@users.noreply.github.com> Co-authored-by: Kim-Adeline Miguel <kimadeline.miguel@mistral.ai> Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com> Co-authored-by: Quentin <torroba.q@gmail.com> Co-authored-by: Simon <80467011+sorgfresser@users.noreply.github.com> Co-authored-by: Simon Van de Kerckhove <simon.vandekerckhove@mistral.ai> Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com> Co-authored-by: angelapopopo <angele.lenglemetz@mistral.ai> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
5103019b01
commit
eb580209d4
180 changed files with 11136 additions and 1030 deletions
54
tests/tools/test_arity.py
Normal file
54
tests/tools/test_arity.py
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from vibe.core.tools.arity import build_session_pattern
|
||||
|
||||
|
||||
class TestBuildSessionPattern:
|
||||
def test_single_token_in_arity(self):
|
||||
assert build_session_pattern(["mkdir", "foo"]) == "mkdir *"
|
||||
|
||||
def test_single_token_not_in_arity(self):
|
||||
assert build_session_pattern(["whoami"]) == "whoami *"
|
||||
|
||||
def test_two_token_arity(self):
|
||||
assert build_session_pattern(["git", "checkout", "main"]) == "git checkout *"
|
||||
|
||||
def test_three_token_arity(self):
|
||||
assert build_session_pattern(["npm", "run", "dev"]) == "npm run dev *"
|
||||
|
||||
def test_longer_prefix_wins(self):
|
||||
# "git" is arity 2, but "git stash" is arity 3
|
||||
assert build_session_pattern(["git", "stash", "pop"]) == "git stash pop *"
|
||||
|
||||
def test_docker_compose(self):
|
||||
assert (
|
||||
build_session_pattern(["docker", "compose", "up", "-d"])
|
||||
== "docker compose up *"
|
||||
)
|
||||
|
||||
def test_empty_tokens(self):
|
||||
assert build_session_pattern([]) == ""
|
||||
|
||||
def test_unknown_command_returns_first_token(self):
|
||||
assert build_session_pattern(["mycommand", "arg1", "arg2"]) == "mycommand *"
|
||||
|
||||
def test_cat_is_arity_1(self):
|
||||
assert build_session_pattern(["cat", "file.txt"]) == "cat *"
|
||||
|
||||
def test_rm_is_arity_1(self):
|
||||
assert build_session_pattern(["rm", "-rf", "dir"]) == "rm *"
|
||||
|
||||
def test_uv_run(self):
|
||||
assert build_session_pattern(["uv", "run", "pytest"]) == "uv run pytest *"
|
||||
|
||||
def test_pip_install(self):
|
||||
assert build_session_pattern(["pip", "install", "numpy"]) == "pip install *"
|
||||
|
||||
def test_git_remote_add(self):
|
||||
assert (
|
||||
build_session_pattern(["git", "remote", "add", "origin", "url"])
|
||||
== "git remote add *"
|
||||
)
|
||||
|
||||
def test_gh_pr_list(self):
|
||||
assert build_session_pattern(["gh", "pr", "list"]) == "gh pr list *"
|
||||
Loading…
Add table
Add a link
Reference in a new issue