Skip to content
Merged
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
7 changes: 4 additions & 3 deletions Benefits Denial/unfair.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
# ============================================================

Expand Down
11 changes: 11 additions & 0 deletions tests/test_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Run from the repo root: pytest tests/ -q
"""

from pathlib import Path

import pandas as pd
import pytest

Expand All @@ -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({
Expand Down
Loading