"""`app.seniority.from_title` against real titles from the 2026-09-29 snapshot, one table, grouped by level, language and trap. No network, no database.""" # The titles are posted with en dashes and typographic apostrophes; the table keeps them. # ruff: noqa: RUF001 from __future__ import annotations import sys from pathlib import Path import pytest ROOT = Path(__file__).resolve().parents[1] if str(ROOT) not in sys.path: sys.path.insert(0, str(ROOT)) from app.models import SENIORITIES # noqa: E402 from app.seniority import from_title # noqa: E402 #: `(title, level)`. A title stays in the table as it was posted, gender #: marker and all, since `from_title` folds it itself. TITLES: list[tuple[str, str]] = [ # ---- exec ("Chief Financial Officer - Satispay Bank", "exec"), ("Chief Information Security Officer - Klarna Bank USA", "exec"), ("Chief Operating Officer (COO) - (Relocation to Luxembourg)", "exec"), ("COO TILL NORDISK CLEAN SOLUTIONS", "exec"), ("CFO med blik for digitale løsninger", "exec"), ("VP of Engineering - Foundational Platform", "exec"), ("SVP of Sales - EMEA (m/f/x)", "exec"), ("Regional Vice President - Enterprise East", "exec"), ("Managing Director, Canada (m/f/d)", "exec"), ("Managing Director Damstahl AB", "exec"), # A C-level named as the boss of the person hired is not the level. ("Executive Assistant to the President", ""), ("Chief of Staff to CHRO", ""), ("Praktikant:in Business Development (m/w/d) - CEO Office", "intern"), ("Senior Executive Business Partner, CFO", "senior"), # ---- director ("Senior Director, Global Partnerships", "director"), ("Sr. Director, Enterprise Data", "director"), ("Director of Engineering (Data Infrastructure)", "director"), ("Director, Pricing", "director"), ("Head of Data & AI Platforms", "director"), ("Head, Logistics Performance", "director"), ("Head ASP Management", "director"), ("Global Head of AV Driver Training", "director"), ("Senior Manager, Head of Transaction Monitoring", "director"), ("Directeur Financier - Afrique de l'Ouest", "director"), ("Directeur·trice technique associé·e", "director"), ("Direktør til Industriens Uddannelser", "director"), ("Director/a de Logística", "director"), ("[DACH MAG] Abteilungsleiter Produktion (all genders)", "director"), ("[DACH MAG] Bereichsleiter Schicht (all genders)", "director"), ("Regionaler Vertriebsleiter im Außendienst (m/w/d) Region nördliches NRW/ Niedersachsen/ Bremen", "director"), # "Head Chef"-like titles and a duty that is only mentioned are not heads. ("Augenoptikermeister mit technischer Leitung (m/w/d) in Berlin WILMA", ""), ("Sous Chef", ""), # ---- senior_manager ("Associate Director, AI Strategy", "senior_manager"), ("Assoc Director, Oral Sema", "senior_manager"), ("Associate Director/Director in Investment Banking - Infrastructure Leveraged Finance", "director"), ("Associate VP, Drug Product Manufacturing US Quality", "senior_manager"), ("Sr. Engineering Manager - Notebook Dataplane", "senior_manager"), ("Senior Engineering Manager - Enterprise Trust & Reliability", "senior_manager"), ("Senior Manager, Strategic Planning", "senior_manager"), ("Sr. Manager, Technical Delivery", "senior_manager"), ("Business Development Sr. Manager", "senior_manager"), # ---- manager ("Engineering Manager - Security Engineering", "manager"), ("Store Leader, Shopping Leblon", "manager"), ("Data Science Manager, Finance Analytics", "manager"), ("Manager, Bid Management", "manager"), ("Manager Sales Enablement", "manager"), ("Country Manager", "manager"), ("Store Manager (pandamart)", "manager"), ("Team Manager Technischer Kundendienst (x/f/m)", "manager"), ("Data Science Manager, Risk", "manager"), ("Director/Sr Manager, Business Planning & GTM", "director"), ("Filialleiter (m/w/d), LEGO Store Hannover", "manager"), ("Kontorchef til Styrelsen for International Rekruttering og Integration (SIRI)", "manager"), ("Försäljningschef till Nordic Polytech Group (NPG)", "manager"), ("Driftsleder Sjåførorganisasjon", "manager"), ("Enhedschef til borgernær akutsygepleje og tildelingsenhed, Afdeling for Borgernær Sundhed", "manager"), ("Chef for Kommunikation", "manager"), ("Gérant(e) - Responsable de magasin", "manager"), ("Responsable Partenariats Terrain B2B H/F", "manager"), ("Gerente de tienda", "manager"), ("Jefe de Posventa", "manager"), # Individual-contributor managers say nothing, or the level beside them. ("Account Manager", ""), ("Key Account Manager Ultrasound (all genders)", ""), ("Product Manager (Agents)", ""), ("Senior Product Manager", "senior"), ("Project Manager", ""), ("Customer Success Manager (DACH)", ""), ("Office Manager - 9 month fixed term contract", ""), ("Sales Manager (m/w/d) – Photovoltaik, Wärmepumpe & intelligente Energiesysteme - 1KOMMA5° Kiel", ""), ("Technical Program Manager, Data Centers", ""), ("Lead Project Manager (German speaker)", "staff"), ("Responsable de projets - Expériences Fever Originals", ""), ("Chef de projet SEO et Marketing Digital H/F", ""), ("Bauleiter AC (m/w/d) für Photovoltaik - 1KOMMA5° Handwerk - Region Bayern", ""), ("Projektleder til produktion af færdigretter", ""), ("Prosjektleder DTO", ""), ("Technologie-Forschungsingenieur für Leistungshalbleiter (w/m/div.)", ""), # ---- lead: a team lead ("Engineering Team Lead - GateManager Platform", "lead"), ("Team Lead - Technical Support", "lead"), ("Team Leader, Operations", "lead"), ("Delivery Station Supervisor", "lead"), ("Warehouse Lead", "lead"), ("[US-DC] Kitchen Lead", "lead"), ("Assistant Store Manager (efood market) - Θεσσαλονίκη", "lead"), ("Augenoptiker (m/w/d) als Assistant Store Manager in Dresden", "lead"), ("Associate Store Leader, Tyson's Corner", "lead"), ("People Leader - Model Design, LEGO® Design", "lead"), ("Chef d'Equipe Mecanique (H/F)", "lead"), ("Teamlead Winkel Schoten (36u)", "lead"), ("Complaints Team Leader - Claims", "lead"), ("Supervisor, Wind Site - Sunzia, NM", "lead"), ("Teamleiter im Bereich HR IT Support (w/m/div.)", "lead"), ("Schichtleiter Warehouse Operations (all genders)", "lead"), ("Gruppenleiter Softwareentwicklung (m/w/x)", "lead"), ("Teamleider Winkel Eindhoven (32-40 uur)", "lead"), ("Chef d'équipe Entrepôt Magasin", "lead"), ("Chef·fe d’équipe - Modélisation (Unreal)", "lead"), ("Superviseur magasin", "lead"), ("B2B Demand Generation Specialist", ""), # ---- distinguished ("Senior Principal Engineer, Central Ops & Systems", "distinguished"), ("Principal/Senior Principal Investment Accounting Solution Consultant – IAS Value Team", "distinguished"), ("Distinguished Engineer, Core DevOps", "distinguished"), ("Business Process Chief Expert CIS", "distinguished"), # "Fellow" alone is academic; the Technical Fellow's office is not the grade. ("Postdoctoral Fellow in Robotics and Computer Vision", ""), ("Principal Engineer, Enterprise AI — Technical Fellow Office", "principal"), # ---- principal ("Senior Staff Software Engineer- Search Quality", "principal"), ("Senior Staff Applications Engineer", "principal"), ("Principal Software Engineer - Platform Engineering", "principal"), ("Principal Product Manager - Audio and Media Playback", "principal"), # ---- staff: Staff, and "Lead" the noun that is not a team lead ("Staff Software Engineer - Money Movement", "staff"), ("Staff+ Software Engineer, Safeguards", "staff"), ("Tech Lead, Deployment & Operations — Custom Infrastructure", "staff"), ("Lead Data Engineer", "staff"), ("Lead Engineer", "staff"), ("Technical Lead- AI Cockpit", "staff"), ("Product Marketing Lead, Experience", "staff"), ("Payroll Lead", "staff"), ("Member of Technical Staff - Research Infrastructure Engineer", ""), ("Chief of Staff (m/w/d)", ""), ("Staff Accountant", ""), # ---- senior ("Senior Site Reliability Engineer", "senior"), ("Sr.Account Development Representative", "senior"), ("Sr Software Engineer -Public Sector", "senior"), ("(Senior) Product Manager - Energy (m/f/d)", "senior"), ("Senior konsult till Knowit FLX", "senior"), ("Chef.fe technique senior du développement - Rainbow Six Siege", "senior"), ("Backend Engineer III", "senior"), # ---- mid ("Backend Engineer - Mid Level - Autopilot Team", "mid"), ("Intermediate Backend Engineer - Database Change Management", "mid"), ("Site Reliability Engineer II, China Tech", "mid"), ("Medior Cloud Developer (AI Integrations)", "mid"), ("Chef de produit trachéotomie confirmé F/H", "mid"), # The "mid" of a market is not a level. ("Account Director, Mid-Market", "director"), ("Account Executive - Mid-Market", ""), # ---- junior ("Junior Data Analyst", "junior"), ("Jr. Metrology Engineer", "junior"), ("(Junior) Key Account Manager (m/w/d)", "junior"), ("Junior Sales Manager (m/w/d) für intelligente Energiesysteme - 1KOMMA5° Göttingen", "junior"), ("Entry Level: Baseband Developer", "junior"), ("Entry-level Sales and Marketing Representative - Tampa, FL - Diablo Tools - DAT", "junior"), ("Graduate Software Engineer", "junior"), ("Software Engineer, New Grad - Frontend", "junior"), ("Sales Trainee", "junior"), ("Junior Managers Program (Trainee) - Start your Leadership Journey in Controlling", "junior"), ("Asistente de marketing Jr. - Sector Automotriz - Lima", "junior"), # ---- intern ("Internship - Business Intelligence", "intern"), ("Financial Planning & Analysis Intern", "intern"), ("Software Engineer, Intern (Summer or Winter)", "intern"), ("Working Student (f/m/d) - HR Learning & Development", "intern"), ("Werkstudent:in Data Analytics (Controlling Focus) (m/w/d)", "intern"), ("Werkstudent*in im Innovationsmanagement (m/w/d) (w/m/div.)", "intern"), ("Praktikum in der Technologieentwicklung", "intern"), ("Pflichtpraktikum Simultaneous Engineering", "intern"), ("Betriebspraktikum für Schüler:innen 2026/2027 (m/w/d) Standort Dresden (STAR)", "intern"), ("Praktikant:in (m/w/d) Technische Planung Photovoltaik - 1KOMMA5° Handwerk - Remote", "intern"), ("Ausbildung Mechatroniker 2027 (m/w/d) für Kassel/Lohfelden", "intern"), ("Lehrausbildung Mechatronik (w/m/div.) ab Herbst 2027", "intern"), ("Master Thesis: Network Digital Twin Fidelity and Synthetic Data Generation for Radio Networks", "intern"), ("Stagiaire Développeur de Logiciels", "intern"), ("Stage - Data Scientist", "intern"), ("Finance Operations - Stage", "intern"), ("Event Coordinator Assistant – Stage (6 mois) Janvier 2027 (F/H/NB)", "intern"), ("Alternant Technicien Maintenance (F/H)", "intern"), ("Apprenti(e) chef(fe) de projet H/F/N", "intern"), ("Studentermedhjælper søges til grøn drift", "intern"), ("Juridisk studentermedarbejder til investeringsafdelingen", "intern"), ("Bliv økonomielev hos Lomax", "intern"), ("Værktøjsmager-/Industriteknikerlærling", "intern"), ("Stage Inkoper", "intern"), ("Jobstudent Klantenservice Franstalig", "intern"), ("Duaal- of deeltijdstudent – Logistiek", "intern"), ("Prácticas Ingeniería i4.0 y BA fábrica componentes automoción", "intern"), ("Jovem Aprendiz ( Apprentice)", "intern"), ("Junior Supply Chain Officer (Apprenticeship)", "intern"), # An internship stays one whoever it reports to. ("SAP iXp Intern (f/m/d) - Office of the Head of Product & Engineering of Consumer Industries", "intern"), ("Praktikum Assistenz im Management des Senior Vice Presidents der Business Unit Building Solutions", "intern"), # English "stage" and machine learning are not French. ("Développeur·euse logiciel en exploitation de modèles d’apprentissage automatique", ""), # ---- nothing said ("Software Engineer - Data Infrastructure", ""), ("Account Executive, Platforms (Hunter)", ""), ("Cloud Engineer", ""), ("Legal Counsel", ""), ("Data Engineer (f/m/div.)", ""), ("Kundenservice Mitarbeiter (w/m/d) - Hybrid", ""), ("Elektroniker in der Leiterkartenfertigung (w/m/div.)", ""), ("", ""), ] #: Titles the snapshot has no example of, written for the traps they test. SYNTHETIC: list[tuple[str, str]] = [ ("Lead Generation Specialist", ""), ("Stage Manager, Touring Production", ""), ("Product Owner - Early Stage", ""), ("Projectleider Logistiek", ""), ("Software Engineer III, Platform", "senior"), ("Manager, Data Science", "manager"), # A grade on a people title lifts it one rung only when it is above the # title's own rung. ("Staff Engineering Manager", "manager"), ("Principal Engineering Manager", "senior_manager"), ("Senior Staff Engineering Manager", "senior_manager"), ("Senior Principal Engineering Manager", "senior_manager"), ("Principal Team Lead", "senior_manager"), ("Staff Tech Lead Manager, Machine Learning, Vision Models", "manager"), # A slash names two levels, the higher of which wins. ("Senior/Principal Unity Developer | New Games", "principal"), ("Senior/Staff Backend Engineer", "staff"), ("Lead/Principal Cloud Engineer – Data Platform", "principal"), ("Assistant Vice President, Credit Risk", "senior_manager"), ("AVP, Operations", "senior_manager"), ("Assistant Director of Finance", "senior_manager"), ("Research Fellow in Economics", ""), ("Fellow", ""), ("Technical Fellow", "distinguished"), ("Engineering Fellow, Silicon", "distinguished"), ("Shift Leader", "lead"), ("Supervisor", "lead"), ] @pytest.mark.parametrize(("title", "level"), TITLES + SYNTHETIC) def test_title(title: str, level: str) -> None: assert from_title(title) == level def test_table_covers_every_level_and_at_least_eighty_titles() -> None: assert len(TITLES) >= 80 assert {level for _, level in TITLES} == set(SENIORITIES) def test_answers_are_seniorities() -> None: assert {from_title(title) for title, _ in TITLES} <= set(SENIORITIES) def test_gender_marker_and_case_do_not_matter() -> None: assert from_title("SENIOR SOFTWARE ENGINEER (m/w/d)") == "senior" assert from_title("senior software engineer (all genders)") == "senior" def test_highest_level_named_wins() -> None: assert from_title("Senior Director of Engineering") == "director" assert from_title("Senior Lead Engineer") == "staff" assert from_title("Junior Principal Engineer") == "principal" assert from_title("Senior Director, Principal Engineering") == "director" assert from_title("Vice President and Managing Director") == "exec" def test_words_are_matched_whole() -> None: # "lead" in "Leadership", "intern" in "International", "vp" nowhere. assert from_title("Leadership Development Programme Coordinator") == "" assert from_title("International Sales Coordinator") == "" assert from_title("Internal Audit Analyst") == "" assert from_title("Directory Services Administrator") == ""