Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions cli/integrations/job_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,8 @@ def _extract_items_from_text(self, text: str) -> List[str]:

# Section header keywords to exclude - only match when line STARTS with these
# (not when they appear in the middle of a sentence)
section_header_starts = [
# Use tuple for fast C-level startswith checking
section_header_starts = (
"requirements",
"qualifications",
"responsibilities",
Expand All @@ -670,7 +671,7 @@ def _extract_items_from_text(self, text: str) -> List[str]:
"team",
"our team",
"the company",
]
)

# Match bullet points
bullet_patterns = [
Expand All @@ -694,10 +695,7 @@ def _extract_items_from_text(self, text: str) -> List[str]:
continue
line_lower = line.lower()
# Skip lines that start with section header keywords
if any(
line_lower.startswith(header) or line_lower.startswith(header + ":")
for header in section_header_starts
):
if line_lower.startswith(section_header_starts):
continue
# Skip lines that look like headers (all caps or very short)
if line.isupper() and len(line) < 50:
Expand Down
8 changes: 5 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""Shared fixtures and test configuration for pytest."""

from __future__ import annotations

from pathlib import Path
from typing import Any, Dict
from typing import Any

import pytest
import yaml
Expand Down Expand Up @@ -32,7 +34,7 @@ def temp_dir(tmp_path: Path) -> Path:


@pytest.fixture
def sample_resume_data() -> Dict[str, Any]:
def sample_resume_data() -> dict[str, Any]:
"""Sample resume data for testing."""
return {
"meta": {"version": "2.0.0", "last_updated": "2024-01-15", "author": "Test Author"},
Expand Down Expand Up @@ -301,7 +303,7 @@ def sample_resume_data() -> Dict[str, Any]:


@pytest.fixture
def sample_yaml_file(temp_dir: Path, sample_resume_data: Dict[str, Any]) -> Path:
def sample_yaml_file(temp_dir: Path, sample_resume_data: dict[str, Any]) -> Path:
"""Create a sample resume.yaml file for testing."""
yaml_path = temp_dir / "resume.yaml"
with open(yaml_path, "w") as f:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_ats_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def test_generate_summary_excellent(self, ats_generator):
"test": ATSCategoryScore("Test", 20, 20, [], []),
}

summary, recommendations = ats_generator._generate_summary(categories, 95, 100)
summary, _ = ats_generator._generate_summary(categories, 95, 100)

assert "Excellent" in summary

Expand All @@ -277,7 +277,7 @@ def test_generate_summary_poor(self, ats_generator):
"test": ATSCategoryScore("Test", 5, 20, [], []),
}

summary, recommendations = ats_generator._generate_summary(categories, 25, 100)
summary, _ = ats_generator._generate_summary(categories, 25, 100)

assert "Poor" in summary or "Fair" in summary

Expand Down
16 changes: 16 additions & 0 deletions tests/test_cli_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def test_validate_valid_resume(self, sample_yaml_file: Path):
result = subprocess.run(
[sys.executable, "-m", "cli.main", "--yaml-path", str(sample_yaml_file), "validate"],
capture_output=True,
check=False,
text=True,
cwd=Path(__file__).parent.parent,
)
Expand All @@ -34,6 +35,7 @@ def test_validate_missing_file(self, temp_dir: Path):
"validate",
],
capture_output=True,
check=False,
text=True,
cwd=Path(__file__).parent.parent,
)
Expand All @@ -50,6 +52,7 @@ def test_variants_lists_all(self, sample_yaml_file: Path):
result = subprocess.run(
[sys.executable, "-m", "cli.main", "--yaml-path", str(sample_yaml_file), "variants"],
capture_output=True,
check=False,
text=True,
cwd=Path(__file__).parent.parent,
)
Expand Down Expand Up @@ -83,6 +86,7 @@ def test_generate_markdown(self, sample_yaml_file: Path, temp_dir: Path):
str(output_file),
],
capture_output=True,
check=False,
text=True,
cwd=Path(__file__).parent.parent,
)
Expand Down Expand Up @@ -113,6 +117,7 @@ def test_generate_tex(self, sample_yaml_file: Path, temp_dir: Path):
str(output_file),
],
capture_output=True,
check=False,
text=True,
cwd=Path(__file__).parent.parent,
)
Expand All @@ -139,6 +144,7 @@ def test_generate_no_save(self, sample_yaml_file: Path):
"--no-save",
],
capture_output=True,
check=False,
text=True,
cwd=Path(__file__).parent.parent,
)
Expand Down Expand Up @@ -180,6 +186,7 @@ def test_apply_logs_application(self, sample_yaml_file: Path, temp_dir: Path, mo
"Software Engineer",
],
capture_output=True,
check=False,
text=True,
cwd=Path(__file__).parent.parent,
)
Expand Down Expand Up @@ -218,6 +225,7 @@ def test_analyze_with_no_data(self, sample_yaml_file: Path, temp_dir: Path, monk
"analyze",
],
capture_output=True,
check=False,
text=True,
cwd=Path(__file__).parent.parent,
)
Expand Down Expand Up @@ -258,6 +266,7 @@ def test_ats_check_with_job_desc(self, sample_yaml_file: Path, temp_dir: Path):
str(job_desc),
],
capture_output=True,
check=False,
text=True,
cwd=Path(__file__).parent.parent,
)
Expand All @@ -279,6 +288,7 @@ def test_ats_check_missing_job_desc(self, sample_yaml_file: Path):
"v1.0.0-base",
],
capture_output=True,
check=False,
text=True,
cwd=Path(__file__).parent.parent,
)
Expand Down Expand Up @@ -321,6 +331,7 @@ def test_keyword_analysis_with_job_desc(self, sample_yaml_file: Path, temp_dir:
str(job_desc),
],
capture_output=True,
check=False,
text=True,
cwd=Path(__file__).parent.parent,
)
Expand All @@ -342,6 +353,7 @@ def test_keyword_analysis_missing_job_desc(self, sample_yaml_file: Path):
"v1.0.0-base",
],
capture_output=True,
check=False,
text=True,
cwd=Path(__file__).parent.parent,
)
Expand All @@ -359,6 +371,7 @@ def test_main_help(self):
result = subprocess.run(
[sys.executable, "-m", "cli.main", "--help"],
capture_output=True,
check=False,
text=True,
cwd=Path(__file__).parent.parent,
)
Expand All @@ -373,6 +386,7 @@ def test_command_help(self):
result = subprocess.run(
[sys.executable, "-m", "cli.main", "generate", "--help"],
capture_output=True,
check=False,
text=True,
cwd=Path(__file__).parent.parent,
)
Expand All @@ -390,6 +404,7 @@ def test_invalid_yaml_path(self):
result = subprocess.run(
[sys.executable, "-m", "cli.main", "--yaml-path", "/nonexistent/path.yaml", "validate"],
capture_output=True,
check=False,
text=True,
cwd=Path(__file__).parent.parent,
)
Expand All @@ -413,6 +428,7 @@ def test_invalid_variant(self, sample_yaml_file: Path):
"md",
],
capture_output=True,
check=False,
text=True,
cwd=Path(__file__).parent.parent,
)
Expand Down
10 changes: 5 additions & 5 deletions tests/test_github_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import json
import subprocess
from datetime import datetime
from datetime import datetime, timezone
from pathlib import Path
from unittest.mock import MagicMock, patch

Expand Down Expand Up @@ -32,8 +32,8 @@ def test_calculate_date_threshold_months_3(self, mock_config: Config):
threshold = sync._calculate_date_threshold(3)

# Should be approximately 3 months ago
threshold_date = datetime.strptime(threshold, "%Y-%m-%d")
now = datetime.now()
threshold_date = datetime.strptime(threshold, "%Y-%m-%d").replace(tzinfo=timezone.utc)
now = datetime.now(timezone.utc)
diff = (now - threshold_date).days

# Should be roughly 90 days (3 months)
Expand All @@ -45,8 +45,8 @@ def test_calculate_date_threshold_months_12(self, mock_config: Config):
threshold = sync._calculate_date_threshold(12)

# Should be approximately 12 months ago
threshold_date = datetime.strptime(threshold, "%Y-%m-%d")
now = datetime.now()
threshold_date = datetime.strptime(threshold, "%Y-%m-%d").replace(tzinfo=timezone.utc)
now = datetime.now(timezone.utc)
diff = (now - threshold_date).days

# Should be roughly 365 days (12 months)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_job_parser_integration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
# /usr/bin/env python3
"""
Integration tests for Job Parser (LinkedIn, Indeed).

Expand Down
4 changes: 2 additions & 2 deletions tests/test_keyword_density.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ def test_extract_job_title(self, keyword_generator):
We are looking for a developer.
"""

title, company = keyword_generator._extract_job_details(job_desc)
title, _ = keyword_generator._extract_job_details(job_desc)

assert title

def test_extract_company(self, keyword_generator):
"""Test extracting company from description."""
job_desc = "Software Engineer\nCompany: Acme Corp\nWe need a developer."

title, company = keyword_generator._extract_job_details(job_desc)
_, company = keyword_generator._extract_job_details(job_desc)

assert company

Expand Down
6 changes: 3 additions & 3 deletions tests/test_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def test_log_application_with_optional_fields(self, mock_config: Config, temp_di
# Read CSV
with open(csv_path, newline="") as f:
reader = csv.DictReader(f)
entry = list(reader)[0]
entry = next(iter(reader))

assert entry["source"] == "LinkedIn"
assert entry["url"] == "https://example.com/job"
Expand Down Expand Up @@ -506,9 +506,9 @@ def test_timeline_with_data(self, mock_config: Config, temp_dir: Path):
tracking = TrackingIntegration(config)

# Add application with today's date
from datetime import datetime
from datetime import datetime, timezone

today = datetime.now().strftime("%Y-%m-%d")
today = datetime.now(timezone.utc).strftime("%Y-%m-%d")

tracking.log_application(company="A", role="R1", status="applied")

Expand Down
4 changes: 2 additions & 2 deletions tests/test_tutorials.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_tutorials_have_required_keys(self):
"""Test that each tutorial has required keys."""
from cli.commands.tutorials import TUTORIALS

for key, tutorial in TUTORIALS.items():
for tutorial in TUTORIALS.values():
assert "title" in tutorial
assert "description" in tutorial
assert "steps" in tutorial
Expand All @@ -30,7 +30,7 @@ def test_tutorial_steps_have_required_keys(self):
"""Test that each tutorial step has required keys."""
from cli.commands.tutorials import TUTORIALS

for key, tutorial in TUTORIALS.items():
for tutorial in TUTORIALS.values():
for step in tutorial["steps"]:
assert "title" in step
assert "content" in step
Expand Down
6 changes: 4 additions & 2 deletions tracking/analyze_performance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
# /usr/bin/env python3
"""
Resume Performance Analyzer

Expand Down Expand Up @@ -281,4 +281,6 @@ def main():


if __name__ == "__main__":
exit(main())
import sys

sys.exit(main())
Loading