SIENTIAPDE-2226: Assign DataFrame before pytest.raises in test

- Build the DataFrame outside the `pytest.raises` block so only the
  call under test can raise the expected ValueError.
This commit is contained in:
2026-10-27 13:37:51 -03:00
parent 3266d34620
commit ada3515688

View File

@@ -134,8 +134,9 @@ def test_set_timezone_on_index_converts_aware_index_to_utc():
def test_set_timezone_on_index_non_datetime_index_raises(): def test_set_timezone_on_index_non_datetime_index_raises():
repo = dmr.DataManagerRepository(MagicMock()) repo = dmr.DataManagerRepository(MagicMock())
df = pd.DataFrame({'v1': [1]})
with pytest.raises(ValueError, match='Index is not a DatetimeIndex'): with pytest.raises(ValueError, match='Index is not a DatetimeIndex'):
repo._set_timezone_on_index(pd.DataFrame({'v1': [1]})) repo._set_timezone_on_index(df)
def test_prepare_training_data_csv_load_failure(): def test_prepare_training_data_csv_load_failure():