mirror of
https://github.com/VectifyAI/PageIndex.git
synced 2026-06-24 20:28:12 +02:00
Remove unused PIFS text window commands
This commit is contained in:
parent
d0c0c67a39
commit
b9e30952ad
5 changed files with 19 additions and 191 deletions
|
|
@ -182,6 +182,23 @@ def test_browse_is_agent_visible_semantic_command(tmp_path):
|
|||
assert executor.command_capabilities()["retrieval"]["semantic"]["commands"] == ["browse"]
|
||||
|
||||
|
||||
def test_shell_text_window_commands_are_not_agent_visible(tmp_path):
|
||||
from pageindex.filesystem import PIFSCommandExecutor, PageIndexFileSystem
|
||||
from pageindex.filesystem.commands import PIFSCommandError
|
||||
|
||||
filesystem = PageIndexFileSystem(workspace=tmp_path / "workspace")
|
||||
executor = PIFSCommandExecutor(filesystem)
|
||||
|
||||
assert not {"head", "tail", "sed"} & executor.allowed_commands()
|
||||
assert not {"head", "tail", "sed"} & set(
|
||||
executor.command_capabilities()["allowed_commands"]
|
||||
)
|
||||
|
||||
for command in ("head /documents/a.txt", "tail /documents/a.txt", "sed -n 1,1p /documents/a.txt"):
|
||||
with pytest.raises(PIFSCommandError, match="Unsupported command"):
|
||||
executor.execute(command)
|
||||
|
||||
|
||||
def test_browse_requires_positional_query_and_rejects_removed_options(tmp_path):
|
||||
from pageindex.filesystem import PIFSCommandExecutor, PageIndexFileSystem
|
||||
from pageindex.filesystem.commands import PIFSCommandError
|
||||
|
|
|
|||
|
|
@ -580,17 +580,6 @@ def test_cat_all_is_limited_to_text_files():
|
|||
executor.execute("cat dsid_json_file --all")
|
||||
opened_json = filesystem.open("dsid_json_file")
|
||||
assert opened_json.text == '{"body":"json"}'
|
||||
for command in (
|
||||
"head dsid_pdf_file",
|
||||
"tail dsid_pdf_file",
|
||||
"sed -n 1,1p dsid_pdf_file",
|
||||
"head dsid_md_file",
|
||||
"tail dsid_md_file",
|
||||
"sed -n 1,1p dsid_md_file",
|
||||
):
|
||||
with pytest.raises(PIFSCommandError, match="only supported for txt/text files"):
|
||||
executor.execute(command)
|
||||
|
||||
|
||||
def test_pageindex_structure_commands_are_limited_to_pdf_and_markdown():
|
||||
from pageindex.filesystem import PIFSCommandExecutor, PageIndexFileSystem
|
||||
|
|
|
|||
|
|
@ -108,9 +108,6 @@ def test_shell_limits_reject_context_expanding_counts(tmp_path):
|
|||
("grep --limit 21 Root /documents", 20),
|
||||
("ls /documents --limit 101", 100),
|
||||
("tree /documents --limit 201", 200),
|
||||
("head -n 101 /documents/Root\\ document", 100),
|
||||
("tail -n 101 /documents/Root\\ document", 100),
|
||||
("sed -n 1,101p /documents/Root\\ document", 100),
|
||||
):
|
||||
with pytest.raises(PIFSCommandError, match=f"at most {limit}"):
|
||||
executor.execute(command)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue