From b35234dded6a45729e5cd1a5fe285ee8ed09f1ca Mon Sep 17 00:00:00 2001 From: "thadidaniel@gmail.com" Date: Sun, 27 Sep 2026 15:08:32 +0530 Subject: [PATCH] fixed the issue and debugged --- Benefits Denial/unfair.py | 7 ++++--- tests/test_proxy.py | 11 +++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Benefits Denial/unfair.py b/Benefits Denial/unfair.py index e401067..8527405 100644 --- a/Benefits Denial/unfair.py +++ b/Benefits Denial/unfair.py @@ -27,9 +27,10 @@ # hours.per.week → Women average 36.4 hrs/wk vs 42.4 for men # due to caregiving burdens, not productivity. # penalizing low hours penalises gender roles. -# occupation → Racial occupational segregation: Black and -# Native applicants are in high-skill roles -# at ~15% vs 26% for White applicants. +# occupation → Racial occupational segregation: Black applicants +# are in high-skill roles at ~15.5% (about half of +# White's 26.2%), while Native applicants are at +# 20.3% (~77% of White's rate). # Occupation encodes race via labour market bias. # ============================================================ diff --git a/tests/test_proxy.py b/tests/test_proxy.py index e6c500e..aeaadee 100644 --- a/tests/test_proxy.py +++ b/tests/test_proxy.py @@ -3,6 +3,8 @@ Run from the repo root: pytest tests/ -q """ +from pathlib import Path + import pandas as pd import pytest @@ -12,6 +14,15 @@ pytest.importorskip("scipy", reason="proxy hints need the optional scipy extra") +def test_benefits_denial_native_proxy_summary_is_not_stale(): + # Regression test for #733: the top-of-file proxy summary must keep + # Native applicants separate from Black applicants, with Native's 20.3% + # rate preserved instead of the stale ~15% lumping that appears elsewhere. + source = (Path(__file__).resolve().parents[1] / "Benefits Denial" / "unfair.py").read_text(encoding="utf-8") + assert "Native applicants are at\n# 20.3% (~77% of White's rate)." in source + assert "Native applicants are at\n# ~15.5%" not in source + + def test_perfect_proxy_is_flagged(): # occupation is a perfect function of sex -> maximal association. df = pd.DataFrame({