test: add -> None return type annotations to all test methods
Some checks failed
CI / test (push) Has been cancelled
Shellhist CI / test (push) Has been cancelled
Shellhist CI / build (push) Has been cancelled

This commit is contained in:
2026-01-31 14:21:28 +00:00
parent 182ab0ad60
commit 2a63c265d2

View File

@@ -16,7 +16,7 @@ from shellhist.core.patterns import CommandPattern
class TestGenerateAlias: class TestGenerateAlias:
"""Test alias generation functionality.""" """Test alias generation functionality."""
def test_generate_alias_single_command(self): def test_generate_alias_single_command(self) -> None:
"""Test generating alias for single command.""" """Test generating alias for single command."""
pattern = CommandPattern( pattern = CommandPattern(
commands=("git status",), commands=("git status",),
@@ -29,7 +29,7 @@ class TestGenerateAlias:
assert alias.startswith("alias ") assert alias.startswith("alias ")
assert "git status" in alias assert "git status" in alias
def test_generate_alias_multiple_commands(self): def test_generate_alias_multiple_commands(self) -> None:
"""Test generating alias for multiple commands.""" """Test generating alias for multiple commands."""
pattern = CommandPattern( pattern = CommandPattern(
commands=("git add .", "git commit", "git push"), commands=("git add .", "git commit", "git push"),
@@ -43,7 +43,7 @@ class TestGenerateAlias:
assert "git commit" in alias assert "git commit" in alias
assert "git push" in alias assert "git push" in alias
def test_generate_alias_custom_name(self): def test_generate_alias_custom_name(self) -> None:
"""Test generating alias with custom name.""" """Test generating alias with custom name."""
pattern = CommandPattern( pattern = CommandPattern(
commands=("echo test",), commands=("echo test",),
@@ -59,7 +59,7 @@ class TestGenerateAlias:
class TestGenerateAliasName: class TestGenerateAliasName:
"""Test alias name generation.""" """Test alias name generation."""
def test_alias_name_from_command(self): def test_alias_name_from_command(self) -> None:
"""Test generating alias name from command.""" """Test generating alias name from command."""
pattern = CommandPattern( pattern = CommandPattern(
commands=("git status",), commands=("git status",),
@@ -71,7 +71,7 @@ class TestGenerateAliasName:
assert "git" in name.lower() or "status" in name.lower() assert "git" in name.lower() or "status" in name.lower()
def test_alias_name_from_multiple_commands(self): def test_alias_name_from_multiple_commands(self) -> None:
"""Test generating alias name from multiple commands.""" """Test generating alias name from multiple commands."""
pattern = CommandPattern( pattern = CommandPattern(
commands=("git add .", "git commit", "git push"), commands=("git add .", "git commit", "git push"),
@@ -87,7 +87,7 @@ class TestGenerateAliasName:
class TestGenerateScript: class TestGenerateScript:
"""Test script generation functionality.""" """Test script generation functionality."""
def test_generate_script_dry_run(self): def test_generate_script_dry_run(self) -> None:
"""Test script generation in dry-run mode.""" """Test script generation in dry-run mode."""
pattern = CommandPattern( pattern = CommandPattern(
commands=("echo hello", "echo world"), commands=("echo hello", "echo world"),
@@ -101,7 +101,7 @@ class TestGenerateScript:
assert "echo world" in content assert "echo world" in content
assert "shellhist_" in path assert "shellhist_" in path
def test_generate_script_with_custom_name(self): def test_generate_script_with_custom_name(self) -> None:
"""Test script generation with custom name.""" """Test script generation with custom name."""
pattern = CommandPattern( pattern = CommandPattern(
commands=("ls -la",), commands=("ls -la",),
@@ -117,7 +117,7 @@ class TestGenerateScript:
assert "my_custom_script" in path assert "my_custom_script" in path
def test_generate_script_actual_write(self): def test_generate_script_actual_write(self) -> None:
"""Test actual script file creation.""" """Test actual script file creation."""
pattern = CommandPattern( pattern = CommandPattern(
commands=("echo test",), commands=("echo test",),
@@ -139,7 +139,7 @@ class TestGenerateScript:
assert "echo test" in saved_content assert "echo test" in saved_content
def test_script_permissions(self): def test_script_permissions(self) -> None:
"""Test that generated scripts are executable.""" """Test that generated scripts are executable."""
pattern = CommandPattern( pattern = CommandPattern(
commands=("echo test",), commands=("echo test",),
@@ -161,7 +161,7 @@ class TestGenerateScript:
class TestGenerateScriptName: class TestGenerateScriptName:
"""Test script name generation.""" """Test script name generation."""
def test_script_name_from_commands(self): def test_script_name_from_commands(self) -> None:
"""Test generating script name from commands.""" """Test generating script name from commands."""
pattern = CommandPattern( pattern = CommandPattern(
commands=("git status", "git log"), commands=("git status", "git log"),
@@ -174,7 +174,7 @@ class TestGenerateScriptName:
assert len(name) > 0 assert len(name) > 0
assert name.startswith("shellhist_") assert name.startswith("shellhist_")
def test_script_name_sanitization(self): def test_script_name_sanitization(self) -> None:
"""Test that script names are sanitized.""" """Test that script names are sanitized."""
pattern = CommandPattern( pattern = CommandPattern(
commands=("ls -la /tmp",), commands=("ls -la /tmp",),