Skip to content

Commit 382623e

Browse files
feat: add comprehensive test suite
This commit introduces a comprehensive test suite for the Python Code Harmonizer, making it production-ready. The project has been restructured into a standard Python package with a pyproject.toml file, and the main application has been refactored into a runnable console script accessible via the `harmonizer` command. A new `tests/` directory contains: - `test_engine.py`: Unit tests for the core semantic engine. - `test_parser.py`: Unit tests for the AST parser. - `test_harmonizer.py`: An integration test for the main application. The `.gitignore` file has also been updated to exclude build artifacts like `*.egg-info/`.
1 parent 356d344 commit 382623e

File tree

8 files changed

+506
-178
lines changed

8 files changed

+506
-178
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
__pycache__/
2+
*.egg-info/

pyproject.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "PythonCodeHarmonizer"
7+
version = "1.1.0"
8+
description = "A semantic code debugger."
9+
readme = "README.md"
10+
license = { file="LICENSE" }
11+
requires-python = ">=3.8"
12+
classifiers = [
13+
"Programming Language :: Python :: 3",
14+
]
15+
16+
[project.scripts]
17+
harmonizer = "src.harmonizer.main:run_cli"
18+
19+
[tool.setuptools.packages.find]
20+
where = ["."]
21+
include = ["src*"]

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pytest

src/divine_invitation_engine_V2.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ def analyze_text(self, text: str) -> Tuple[Coordinates, int]:
193193
self._word_cache[cache_key] = result
194194
return result
195195

196+
@property
197+
def all_keywords(self) -> Set[str]:
198+
"""Returns all unique keywords from the vocabulary."""
199+
return set(self._keyword_map.keys())
200+
196201
@staticmethod
197202
def get_distance(c1: Coordinates, c2: Coordinates) -> float:
198203
"""Optimized Euclidean distance calculation"""

0 commit comments

Comments
 (0)