chore: import upstream snapshot with attribution
Test Vector Database Adaptors / Test MCP Vector DB Tools (push) Has been cancelled
Tests / Code Quality (Ruff & Mypy) (push) Has been cancelled
Tests / Fast Unit Tests (parallel) (macos-latest, 3.11) (push) Has been cancelled
Tests / Fast Unit Tests (parallel) (macos-latest, 3.12) (push) Has been cancelled
Tests / Tests (push) Has been cancelled
Docker Publish / Build and Push Docker Images (map[description:Skill Seekers CLI - Convert documentation to AI skills dockerfile:Dockerfile name:skill-seekers]) (push) Has been cancelled
Docker Publish / Build and Push Docker Images (map[description:Skill Seekers MCP Server - 25 tools for AI assistants dockerfile:Dockerfile.mcp name:skill-seekers-mcp]) (push) Has been cancelled
Docker Publish / Test Docker Images (push) Has been cancelled
Tests / Fast Unit Tests (parallel) (ubuntu-latest, 3.10) (push) Has been cancelled
Tests / Fast Unit Tests (parallel) (ubuntu-latest, 3.11) (push) Has been cancelled
Tests / Fast Unit Tests (parallel) (ubuntu-latest, 3.12) (push) Has been cancelled
Tests / Serial / Integration / E2E Tests (push) Has been cancelled
Tests / MCP Server Tests (push) Has been cancelled
Test Vector Database Adaptors / Test chroma Adaptor (push) Has been cancelled
Test Vector Database Adaptors / Test faiss Adaptor (push) Has been cancelled
Test Vector Database Adaptors / Test qdrant Adaptor (push) Has been cancelled
Test Vector Database Adaptors / Test weaviate Adaptor (push) Has been cancelled
Test Vector Database Adaptors / Test MCP Vector DB Tools (push) Has been cancelled
Tests / Code Quality (Ruff & Mypy) (push) Has been cancelled
Tests / Fast Unit Tests (parallel) (macos-latest, 3.11) (push) Has been cancelled
Tests / Fast Unit Tests (parallel) (macos-latest, 3.12) (push) Has been cancelled
Tests / Tests (push) Has been cancelled
Docker Publish / Build and Push Docker Images (map[description:Skill Seekers CLI - Convert documentation to AI skills dockerfile:Dockerfile name:skill-seekers]) (push) Has been cancelled
Docker Publish / Build and Push Docker Images (map[description:Skill Seekers MCP Server - 25 tools for AI assistants dockerfile:Dockerfile.mcp name:skill-seekers-mcp]) (push) Has been cancelled
Docker Publish / Test Docker Images (push) Has been cancelled
Tests / Fast Unit Tests (parallel) (ubuntu-latest, 3.10) (push) Has been cancelled
Tests / Fast Unit Tests (parallel) (ubuntu-latest, 3.11) (push) Has been cancelled
Tests / Fast Unit Tests (parallel) (ubuntu-latest, 3.12) (push) Has been cancelled
Tests / Serial / Integration / E2E Tests (push) Has been cancelled
Tests / MCP Server Tests (push) Has been cancelled
Test Vector Database Adaptors / Test chroma Adaptor (push) Has been cancelled
Test Vector Database Adaptors / Test faiss Adaptor (push) Has been cancelled
Test Vector Database Adaptors / Test qdrant Adaptor (push) Has been cancelled
Test Vector Database Adaptors / Test weaviate Adaptor (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
"""Encoding stress tests for code_analyzer and scraper modules.
|
||||
|
||||
Tests that the system gracefully handles non-standard encodings,
|
||||
byte order marks, mixed newlines, and binary files.
|
||||
"""
|
||||
|
||||
from skill_seekers.cli.code_analyzer import CodeAnalyzer
|
||||
|
||||
|
||||
class TestEncodingEdgeCases:
|
||||
def setup_method(self):
|
||||
self.analyzer = CodeAnalyzer(depth="deep")
|
||||
|
||||
def test_utf8_bom_file(self):
|
||||
content = "\ufeff# -*- coding: utf-8 -*-\ndef hello():\n return 'world'\n"
|
||||
result = self.analyzer.analyze_file("test.py", content, "Python")
|
||||
if result:
|
||||
assert "functions" in result
|
||||
funcs = result.get("functions", [])
|
||||
if funcs:
|
||||
assert any(f["name"] == "hello" for f in funcs)
|
||||
|
||||
def test_latin1_escaped(self):
|
||||
content = "# coding: latin-1\ndef greet():\n return 'héllo'\n"
|
||||
result = self.analyzer.analyze_file("test.py", content, "Python")
|
||||
if result:
|
||||
assert "functions" in result
|
||||
|
||||
def test_crlf_newlines(self):
|
||||
content = "class Foo:\r\n def bar(self):\r\n return 1\r\n"
|
||||
result = self.analyzer.analyze_file("test.py", content, "Python")
|
||||
if result:
|
||||
assert "classes" in result
|
||||
|
||||
def test_mixed_newlines(self):
|
||||
content = "class Foo:\r\n def bar(self):\r return 1\n"
|
||||
result = self.analyzer.analyze_file("test.py", content, "Python")
|
||||
if result:
|
||||
assert "classes" in result
|
||||
|
||||
def test_binary_file_skipped(self):
|
||||
content = "\x00\x01\x02\x03\x04binary content\x00\x00"
|
||||
result = self.analyzer.analyze_file("test.bin", content, "Python")
|
||||
assert result is None or isinstance(result, dict)
|
||||
|
||||
def test_null_bytes_in_code(self):
|
||||
content = "def valid():\n return None\n\ndef also_valid():\n pass\n"
|
||||
result = self.analyzer.analyze_file("test.py", content, "Python")
|
||||
if result:
|
||||
assert "functions" in result
|
||||
|
||||
def test_tabs_as_indentation(self):
|
||||
content = "def tabbed():\n\tx = 1\n\ty = 2\n\treturn x + y\n"
|
||||
result = self.analyzer.analyze_file("test.py", content, "Python")
|
||||
if result:
|
||||
assert "functions" in result
|
||||
|
||||
def test_very_long_identifier(self):
|
||||
long_name = "a" * 100
|
||||
content = f"def {long_name}():\n pass\n"
|
||||
result = self.analyzer.analyze_file("test.py", content, "Python")
|
||||
if result:
|
||||
assert "functions" in result
|
||||
|
||||
def test_single_long_line(self):
|
||||
"""Single very long line should not crash."""
|
||||
content = "x = " + '"' + "a" * 5000 + '"\n'
|
||||
result = self.analyzer.analyze_file("test.py", content, "Python")
|
||||
assert result is None or isinstance(result, dict)
|
||||
|
||||
def test_deeply_nested_code(self):
|
||||
"""Deeply nested structures should not hit recursion limits."""
|
||||
nested = "def outer():\n"
|
||||
for i in range(50):
|
||||
nested += f" def inner_{i}():\n"
|
||||
nested += " pass\n"
|
||||
result = self.analyzer.analyze_file("test.py", nested, "Python")
|
||||
assert isinstance(result, dict)
|
||||
Reference in New Issue
Block a user