File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
test_pownet/test_optim_model Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 1- """variable .py: Contains functions for adding variables to the optimization model."""
1+ """variable_func .py: Contains functions for adding variables to the optimization model."""
22
33import gurobipy as gp
44from gurobipy import GRB
Original file line number Diff line number Diff line change 1+ """test_variable_func.py"""
2+
13import unittest
24from unittest .mock import MagicMock , patch , call
35import pandas as pd
79
810class TestVariableFunctions (unittest .TestCase ):
911
12+ @classmethod
13+ def setUpClass (cls ):
14+ """Set up class-level resources or patches before any tests in the class run."""
15+ variable_func .VAR_PREFIX_THERMAL_GENERATION = "thermal_generation"
16+
1017 def setUp (self ):
1118 """Set up common test data and mocks."""
19+
20+ self .VAR_PREFIX_THERMAL_GENERATION = "thermal_generation"
21+
1222 self .timesteps = range (
1323 3
1424 ) # Global timestep as per user request (implicitly via usage)
@@ -251,9 +261,4 @@ def edge_hour_side_effect(var_name):
251261
252262# This allows running the tests directly from the script
253263if __name__ == "__main__" :
254-
255- # Ensure the variable prefix is set for the test
256- if not hasattr (variable_func , "VAR_PREFIX_THERMAL_GENERATION" ):
257- variable_func .VAR_PREFIX_THERMAL_GENERATION = "thermal_generation"
258-
259264 unittest .main ()
You can’t perform that action at this time.
0 commit comments