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:
@@ -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():
|
||||
repo = dmr.DataManagerRepository(MagicMock())
|
||||
df = pd.DataFrame({'v1': [1]})
|
||||
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():
|
||||
|
||||
Reference in New Issue
Block a user