Skip to content
This repository was archived by the owner on Aug 1, 2026. It is now read-only.

Commit bacf419

Browse files
author
error-wtf
committed
FIX: Handle missing n_round column in test_data_validation.py
Problem: KeyError when accessing df['n_round'] with fallback data Solution: Check if column exists before accessing it Fixed test_phi_debug_data_values: - Check if 'n_round' in df.columns before accessing - Print appropriate warning if column missing (fallback data) - Prevents KeyError: 'n_round' with perfect_paired_results.csv or real_data_full.csv This was causing FAILURES in the test output log even though tests had fallback logic.
1 parent ae85b79 commit bacf419

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

scripts/tests/test_data_validation.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,16 @@ def test_phi_debug_data_values():
190190
print(f"✅ Masses positive")
191191
print(f" M_solar range: {df['M_solar'].min():.2e} - {df['M_solar'].max():.2e}")
192192

193-
# n_round checks
194-
n_round_vals = df['n_round'].dropna()
195-
if len(n_round_vals) > 0:
196-
print(f"✅ n_round values present: {len(n_round_vals)}")
197-
print(f" n_round range: {n_round_vals.min():.4f} - {n_round_vals.max():.4f}")
193+
# n_round checks (optional column)
194+
if 'n_round' in df.columns:
195+
n_round_vals = df['n_round'].dropna()
196+
if len(n_round_vals) > 0:
197+
print(f"✅ n_round values present: {len(n_round_vals)}")
198+
print(f" n_round range: {n_round_vals.min():.4f} - {n_round_vals.max():.4f}")
199+
else:
200+
print(f"⚠️ n_round column exists but all values are NaN")
201+
else:
202+
print(f"⚠️ n_round column not present (using fallback data)")
198203

199204
print("="*80)
200205

0 commit comments

Comments
 (0)