Skip to content

Commit 802ca7f

Browse files
committed
Update test against the deprecated stuff
1 parent 90d5e9c commit 802ca7f

3 files changed

Lines changed: 10 additions & 17 deletions

File tree

tests/test_config.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,6 @@ def test_attribute_modification(self):
211211
assert CONFIG.Modeling.big == 12345678
212212
assert CONFIG.Solving.mip_gap == 0.001
213213

214-
def test_change_logging_level_deprecated(self):
215-
"""Test deprecated change_logging_level function."""
216-
from flixopt import change_logging_level
217-
218-
with pytest.warns(DeprecationWarning, match='change_logging_level is deprecated'):
219-
change_logging_level('INFO')
220-
221214
def test_exception_logging(self, capfd):
222215
"""Test that exceptions are properly logged with tracebacks."""
223216
CONFIG.Logging.enable_console('INFO')

tests/test_integration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,13 @@ def modeling_calculation(self, request, flow_system_long, highs_solver):
267267
calc.do_modeling()
268268
calc.solve(highs_solver)
269269
elif modeling_type == 'segmented':
270-
calc = fx.SegmentedCalculation('segModel', flow_system, timesteps_per_segment=96, overlap_timesteps=1)
270+
calc = fx.SegmentedOptimization('segModel', flow_system, timesteps_per_segment=96, overlap_timesteps=1)
271271
calc.do_modeling_and_solve(highs_solver)
272272
elif modeling_type == 'aggregated':
273-
calc = fx.AggregatedCalculation(
273+
calc = fx.ClusteredOptimization(
274274
'aggModel',
275275
flow_system,
276-
fx.AggregationParameters(
276+
fx.ClusteringParameters(
277277
hours_per_period=6,
278278
nr_of_periods=4,
279279
fix_storage_flows=False,

tests/test_scenarios.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ def test_scenarios_selection(flow_system_piecewise_conversion_scenarios):
345345

346346
assert flow_system.scenarios.equals(flow_system_full.scenarios[0:2])
347347

348-
np.testing.assert_allclose(flow_system.weights.values, flow_system_full.weights[0:2])
348+
np.testing.assert_allclose(flow_system.scenario_weights.values, flow_system_full.scenario_weights[0:2])
349349

350350
calc = fx.Optimization(flow_system=flow_system, name='test_scenarios_selection', normalize_weights=False)
351351
calc.do_modeling()
@@ -357,8 +357,8 @@ def test_scenarios_selection(flow_system_piecewise_conversion_scenarios):
357357
np.testing.assert_allclose(
358358
calc.results.objective,
359359
(
360-
(calc.results.solution['costs'] * flow_system.weights).sum()
361-
+ (calc.results.solution['Penalty'] * flow_system.weights).sum()
360+
(calc.results.solution['costs'] * flow_system.scenario_weights).sum()
361+
+ (calc.results.solution['Penalty'] * flow_system.scenario_weights).sum()
362362
).item(),
363363
) ## Account for rounding errors
364364

@@ -752,8 +752,8 @@ def test_weights_io_persistence():
752752
fs_loaded = fx.FlowSystem.from_dataset(ds)
753753

754754
# Verify weights persisted correctly
755-
np.testing.assert_allclose(fs_loaded.weights.values, fs_original.weights.values)
756-
assert fs_loaded.weights.dims == fs_original.weights.dims
755+
np.testing.assert_allclose(fs_loaded.scenario_weights.values, fs_original.scenario_weights.values)
756+
assert fs_loaded.scenario_weights.dims == fs_original.scenario_weights.dims
757757

758758

759759
def test_weights_selection():
@@ -788,7 +788,7 @@ def test_weights_selection():
788788

789789
# Verify weights are correctly sliced
790790
assert fs_subset.scenarios.equals(pd.Index(['base', 'high'], name='scenario'))
791-
np.testing.assert_allclose(fs_subset.weights.values, custom_scenario_weights[[0, 2]])
791+
np.testing.assert_allclose(fs_subset.scenario_weights.values, custom_scenario_weights[[0, 2]])
792792

793793
# Verify weights are 1D with just scenario dimension (no period dimension)
794-
assert fs_subset.weights.dims == ('scenario',)
794+
assert fs_subset.scenario_weights.dims == ('scenario',)

0 commit comments

Comments
 (0)