From 0be3d198ea89683b6e6abeb37b5bae74659f0d2f Mon Sep 17 00:00:00 2001 From: StudentSuite3 Date: Fri, 28 Aug 2026 18:40:36 +0530 Subject: [PATCH] Add test for cross profile with same column twice --- tests/test_cli.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_cli.py b/tests/test_cli.py index c63d9d8..87b0313 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -278,6 +278,17 @@ def test_profile_malformed_cross_returns_2_with_clean_error(tmp_path, capsys): assert "--cross expects two column names: COLA,COLB" in captured.err +def test_profile_cross_same_column_twice_returns_2_with_clean_error(tmp_path, capsys): + path = tmp_path / "a.csv" + path.write_text("sex\nM\nF\n", encoding="utf-8") + + exit_code = main(["profile", str(path), "--cross", "sex,sex"]) + + captured = capsys.readouterr() + assert exit_code == 2 + assert "--cross needs two different columns, got 'sex' twice" in captured.err + + def test_profile_reference_missing_required_columns_returns_2_with_clean_error(tmp_path, capsys): path = tmp_path / "a.csv" path.write_text("sex\nM\nF\n", encoding="utf-8")