This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
"""Tests for shell generation module."""
|
||||
|
||||
import pytest
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from shellgenius.generation import (
|
||||
ShellGenerator,
|
||||
ShellParser,
|
||||
ShellSafetyChecker,
|
||||
PromptTemplates,
|
||||
GeneratedScript,
|
||||
)
|
||||
|
||||
|
||||
@@ -59,7 +56,7 @@ class TestShellSafetyChecker:
|
||||
checker = ShellSafetyChecker()
|
||||
is_safe, warnings = checker.check_command("ls -la")
|
||||
|
||||
assert is_safe == True
|
||||
assert is_safe
|
||||
assert len(warnings) == 0
|
||||
|
||||
def test_dangerous_command(self):
|
||||
@@ -67,7 +64,7 @@ class TestShellSafetyChecker:
|
||||
checker = ShellSafetyChecker()
|
||||
is_safe, warnings = checker.check_command("rm -rf /")
|
||||
|
||||
assert is_safe == False
|
||||
assert not is_safe
|
||||
assert any("DANGEROUS" in w for w in warnings)
|
||||
|
||||
def test_warning_patterns(self):
|
||||
@@ -83,7 +80,7 @@ class TestShellSafetyChecker:
|
||||
checker = ShellSafetyChecker()
|
||||
result = checker.check_script(script)
|
||||
|
||||
assert result["is_safe"] == False
|
||||
assert not result["is_safe"]
|
||||
assert len(result["issues"]) > 0
|
||||
|
||||
|
||||
@@ -100,7 +97,7 @@ class TestPromptTemplates:
|
||||
"""Test explanation prompt creation."""
|
||||
prompt = PromptTemplates.get_explain_prompt("echo hello", "bash")
|
||||
|
||||
assert "explain" in prompt
|
||||
assert "Explain" in prompt
|
||||
assert "echo hello" in prompt
|
||||
|
||||
def test_get_refactor_prompt(self):
|
||||
|
||||
Reference in New Issue
Block a user