diff --git a/postreise/analyze/generation/tests/test_binding.py b/postreise/analyze/generation/tests/test_binding.py index 753d6446d..787e99a8b 100644 --- a/postreise/analyze/generation/tests/test_binding.py +++ b/postreise/analyze/generation/tests/test_binding.py @@ -79,28 +79,31 @@ def setUp(self): }) self.default_expected.set_index('UTC', inplace=True) + def get_default_expected(self): + return self.default_expected.copy() + def test_ramp_constraints_default(self): binding_ramps = ramp_constraints(self.mock_scenario) - expected = self.default_expected.copy() - assert binding_ramps.equals(expected) + expected = self.get_default_expected() + assert binding_ramps.equals(self.get_default_expected()) def test_ramp_constraints_spec_epsilon1(self): # Same results as test_ramp_constraints_default binding_ramps = ramp_constraints(self.mock_scenario, epsilon=1e-3) - expected = self.default_expected.copy() + expected = self.get_default_expected() assert binding_ramps.equals(expected) def test_ramp_constraints_spec_epsilon2(self): # One differece from test_ramp_constraints_default: ('A', 't3') binding_ramps = ramp_constraints(self.mock_scenario, epsilon=1e-6) - expected = self.default_expected.copy() + expected = self.get_default_expected() expected.loc['t3', 'A'] = False assert binding_ramps.equals(expected) def test_ramp_constraints_spec_epsilon3(self): # Two differeces from test_ramp_constraints_default: ('A', ['t3'/'t4']) binding_ramps = ramp_constraints(self.mock_scenario, epsilon=1e-9) - expected = self.default_expected.copy() + expected = self.get_default_expected() expected.loc[:, 'A'] = False assert binding_ramps.equals(expected) @@ -131,25 +134,28 @@ def setUp(self): }) self.default_expected.set_index('UTC', inplace=True) + def get_default_expected(self): + return self.default_expected.copy() + def test_pmin_constraints_default(self): binding_pmins = pmin_constraints(self.mock_scenario) - expected = self.default_expected.copy() + expected = self.get_default_expected() assert binding_pmins.equals(expected) def test_pmin_constraints_default_spec_epsilon1(self): binding_pmins = pmin_constraints(self.mock_scenario, epsilon=1e-3) - expected = self.default_expected.copy() + expected = self.get_default_expected() assert binding_pmins.equals(expected) def test_pmin_constraints_default_spec_epsilon2(self): binding_pmins = pmin_constraints(self.mock_scenario, epsilon=1e-6) - expected = self.default_expected.copy() + expected = self.get_default_expected() expected.loc['t1', 'B'] = False assert binding_pmins.equals(expected) def test_pmin_constraints_default_spec_epsilon3(self): binding_pmins = pmin_constraints(self.mock_scenario, epsilon=1e-9) - expected = self.default_expected.copy() + expected = self.get_default_expected() expected.loc['t1', 'B'] = False expected.loc['t2', 'C'] = False assert binding_pmins.equals(expected) @@ -181,25 +187,28 @@ def setUp(self): }) self.default_expected.set_index('UTC', inplace=True) + def get_default_expected(self): + return self.default_expected.copy() + def test_pmax_constraints_default(self): binding_pmaxs = pmax_constraints(self.mock_scenario) - expected = self.default_expected.copy() + expected = self.get_default_expected() assert binding_pmaxs.equals(expected) def test_pmax_constraints_default_sepc_epsilon1(self): binding_pmaxs = pmax_constraints(self.mock_scenario, epsilon=1e-3) - expected = self.default_expected.copy() + expected = self.get_default_expected() assert binding_pmaxs.equals(expected) def test_pmax_constraints_default_sepc_epsilon2(self): binding_pmaxs = pmax_constraints(self.mock_scenario, epsilon=1e-6) - expected = self.default_expected.copy() + expected = self.get_default_expected() expected.loc['t1', 'B'] = False assert binding_pmaxs.equals(expected) def test_pmax_constraints_default_sepc_epsilon3(self): binding_pmaxs = pmax_constraints(self.mock_scenario, epsilon=1e-9) - expected = self.default_expected.copy() + expected = self.get_default_expected() expected.loc['t1', 'B'] = False expected.loc['t2', 'C'] = False assert binding_pmaxs.equals(expected)