import pytest from textwrap import dedent from job_research.profile.profile_parser import parse_profile_markdown def test_parse_profile_markdown_reads_light_required_template() -> None: markdown = dedent( """ # Candidate Profile ## Summary Junior data engineer focused on Python and GCP. ## Target Roles * Data Engineer + Analytics Engineer ## Strengths - Python - SQL ## Skills To Emphasize - BigQuery - Terraform ## Constraints - CDI only - France only ## Notes Slight preference for French listings. """ ).strip() profile = parse_profile_markdown(markdown) assert profile.summary == "Junior data engineer focused on Python and GCP." assert profile.target_roles == ["Data Engineer", "Analytics Engineer"] assert profile.strengths == ["Python", "SQL"] assert profile.skills_to_emphasize == ["BigQuery", "Terraform"] assert profile.constraints == ["CDI only", "France only"] assert profile.notes == ["Slight preference for French listings."] def test_parse_profile_markdown_rejects_unsupported_list_content() -> None: markdown = dedent( """ # Candidate Profile ## Summary Junior data engineer focused on Python and GCP. ## Target Roles - Data Engineer Analytics Engineer ## Strengths - Python ## Skills To Emphasize - BigQuery ## Constraints - CDI only ## Notes - Slight preference for French listings. """ ).strip() with pytest.raises(ValueError, match="Unsupported content in section 'target roles'"): parse_profile_markdown(markdown) @pytest.mark.parametrize("section_name", ["Target Roles", "Notes"]) def test_parse_profile_markdown_rejects_blank_bullet_only_required_sections( section_name: str, ) -> None: target_roles = "- " if section_name == "Target Roles" else "- Data Engineer" notes = "- " if section_name == "Notes" else "Slight preference for French listings." markdown = dedent( f""" # Candidate Profile ## Summary Junior data engineer focused on Python and GCP. ## Target Roles {target_roles} ## Strengths - Python ## Skills To Emphasize - BigQuery ## Constraints - CDI only ## Notes {notes} """ ).strip() with pytest.raises(ValueError, match=f"Missing usable content in section '{section_name.lower()}'"): parse_profile_markdown(markdown)