1919
2020
2121def _get_example_step_function_dict ():
22- return dict (
23- {
24- "name" : "Apply chloride policy" ,
25- "description" : "this rules indicates whether the chloride policy should be applied (1.0) or not (0.0) depending on the chloride concentration." ,
26- "limit_response_table" : [
27- ["limit" , "response" ],
28- [1.0 , 1.0 ],
29- [450 , 0.0 ],
30- ],
31- "input_variable" : "chloride_top_layer" ,
32- "output_variable" : "response_chloride_top_layer" ,
33- }
34- )
22+ return {
23+ "name" : "Apply chloride policy" ,
24+ "description" : "this rules indicates whether the chloride policy should be applied (1.0) or not (0.0) depending on the chloride concentration." ,
25+ "limit_response_table" : [
26+ ["limit" , "response" ],
27+ [1.0 , 1.0 ],
28+ [450 , 0.0 ],
29+ ],
30+ "input_variable" : "chloride_top_layer" ,
31+ "output_variable" : "response_chloride_top_layer" ,
32+ }
3533
3634
3735def test_parser_step_function_rule_correct_input ():
3836 """The ParserStepFunctionRule should parse the provided dictionary
3937 to correctly initialize itself during creation"""
4038
4139 # Arrange
42- new_dict = dict (
43- {
44- "name" : "Test name" ,
45- "description" : "Test description" ,
46- "limit_response_table" : [
47- ["limit" , "response" ],
48- [0.0 , 10.0 ],
49- [1.0 , 20.0 ],
50- [2.0 , 30.0 ],
51- [10.0 , 40.0 ],
52- ],
53- "input_variable" : "test input variable name" ,
54- "output_variable" : "test output variable name" ,
55- }
56- )
40+ new_dict = {
41+ "name" : "Test name" ,
42+ "description" : "Test description" ,
43+ "limit_response_table" : [
44+ ["limit" , "response" ],
45+ [0.0 , 10.0 ],
46+ [1.0 , 20.0 ],
47+ [2.0 , 30.0 ],
48+ [10.0 , 40.0 ],
49+ ],
50+ "input_variable" : "test input variable name" ,
51+ "output_variable" : "test output variable name" ,
52+ }
5753 parser = ParserStepFunctionRule ()
5854 logger = Mock (ILogger )
5955
@@ -100,28 +96,26 @@ def test_parser_does_not_change_ordered__limits():
10096 """If the limits are sorted, the ParserStepFunctionRule
10197 should not modify the order."""
10298 # Arrange
103- rule_dict = dict (
104- {
105- "name" : "Test name" ,
106- "description" : "Test description" ,
107- "limit_response_table" : [
108- ["limit" , "response" ],
109- [0.0 , 0.0 ],
110- [1.0 , 10.0 ],
111- [2.0 , 20.0 ],
112- [3.0 , 30.0 ],
113- [4.0 , 40.0 ],
114- [5.0 , 50.0 ],
115- [6.0 , 60.0 ],
116- [7.0 , 70.0 ],
117- [8.0 , 80.0 ],
118- [9.0 , 90.0 ],
119- [10.0 , 100.0 ],
120- ],
121- "input_variable" : "test input variable name" ,
122- "output_variable" : "test output variable name" ,
123- }
124- )
99+ rule_dict = {
100+ "name" : "Test name" ,
101+ "description" : "Test description" ,
102+ "limit_response_table" : [
103+ ["limit" , "response" ],
104+ [0.0 , 0.0 ],
105+ [1.0 , 10.0 ],
106+ [2.0 , 20.0 ],
107+ [3.0 , 30.0 ],
108+ [4.0 , 40.0 ],
109+ [5.0 , 50.0 ],
110+ [6.0 , 60.0 ],
111+ [7.0 , 70.0 ],
112+ [8.0 , 80.0 ],
113+ [9.0 , 90.0 ],
114+ [10.0 , 100.0 ],
115+ ],
116+ "input_variable" : "test input variable name" ,
117+ "output_variable" : "test output variable name" ,
118+ }
125119 parser = ParserStepFunctionRule ()
126120 logger = Mock (ILogger )
127121
@@ -137,28 +131,26 @@ def test_parser_sorts_unordered_limits():
137131 limits in an increasing order. The respective responses
138132 should also be sorted accordingly."""
139133 # Arrange
140- rule_dict = dict (
141- {
142- "name" : "Test name" ,
143- "description" : "Test description" ,
144- "limit_response_table" : [
145- ["limit" , "response" ],
146- [0.0 , 0.0 ],
147- [1.0 , 10.0 ],
148- [2.0 , 20.0 ],
149- [3.0 , 30.0 ],
150- [4.0 , 40.0 ],
151- [5.0 , 50.0 ],
152- [6.0 , 60.0 ],
153- [7.0 , 70.0 ],
154- [8.0 , 80.0 ],
155- [9.0 , 90.0 ],
156- [10.0 , 100.0 ],
157- ],
158- "input_variable" : "test input variable name" ,
159- "output_variable" : "test output variable name" ,
160- }
161- )
134+ rule_dict = {
135+ "name" : "Test name" ,
136+ "description" : "Test description" ,
137+ "limit_response_table" : [
138+ ["limit" , "response" ],
139+ [0.0 , 0.0 ],
140+ [1.0 , 10.0 ],
141+ [2.0 , 20.0 ],
142+ [3.0 , 30.0 ],
143+ [4.0 , 40.0 ],
144+ [5.0 , 50.0 ],
145+ [6.0 , 60.0 ],
146+ [7.0 , 70.0 ],
147+ [8.0 , 80.0 ],
148+ [9.0 , 90.0 ],
149+ [10.0 , 100.0 ],
150+ ],
151+ "input_variable" : "test input variable name" ,
152+ "output_variable" : "test output variable name" ,
153+ }
162154 parser = ParserStepFunctionRule ()
163155 logger = Mock (ILogger )
164156 expected_log_message = "Limits were not ordered. They have been sorted increasingly, and their respective responses accordingly too."
0 commit comments