@@ -100,7 +100,9 @@ def test_plotting_and_contributions(self):
100100 (DummyPhysicalProperty , 'DummyPhysicalProperty' ),
101101 ],
102102 )
103- def test_name_setting_during_normalization (self , instantiator : callable , reference : str ):
103+ def test_name_setting_during_normalization (
104+ self , instantiator : callable , reference : str
105+ ):
104106 """
105107 Test that the name is set during normalization for PhysicalProperty.
106108 """
@@ -110,37 +112,43 @@ def test_name_setting_during_normalization(self, instantiator: callable, referen
110112
111113 @pytest .mark .parametrize (
112114 'has_nested_contributions, log_ref' ,
113- [
114- (True , True ),
115- (False , False )
116- ],
115+ [(True , True ), (False , False )],
117116 )
118- def test_contributions_validation (self , caplog , has_nested_contributions : bool , log_ref : bool ):
117+ def test_contributions_validation (
118+ self , caplog , has_nested_contributions : bool , log_ref : bool
119+ ):
119120 """
120121 Test contributions validation during normalization.
121-
122+
122123 Args:
123124 has_nested_contributions: Whether to create nested contribution structure
124125 log_ref: Whether validation error should be logged
125126 """
126127 main_property = DummyPhysicalProperty (source = 'simulation' , name = 'main' )
127-
128+
128129 if has_nested_contributions :
129- nested_contribution = DummyPhysicalProperty (source = 'analysis' , name = 'nested' )
130- contribution_with_nested = DummyPhysicalProperty (source = 'analysis' , name = 'parent_contribution' )
130+ nested_contribution = DummyPhysicalProperty (
131+ source = 'analysis' , name = 'nested'
132+ )
133+ contribution_with_nested = DummyPhysicalProperty (
134+ source = 'analysis' , name = 'parent_contribution'
135+ )
131136 contribution_with_nested .contributions = [nested_contribution ]
132137 main_property .contributions = [contribution_with_nested ]
133138 else :
134139 contribution1 = DummyPhysicalProperty (source = 'analysis' , name = 'contrib1' )
135140 contribution2 = DummyPhysicalProperty (source = 'analysis' , name = 'contrib2' )
136141 main_property .contributions = [contribution1 , contribution2 ]
137-
142+
138143 with caplog .at_level ('ERROR' ):
139144 main_property .normalize (EntryArchive (), logger )
140-
141- has_nested_error = any ('nested contributions' in record .message .lower () for record in caplog .records )
145+
146+ has_nested_error = any (
147+ 'nested contributions' in record .message .lower ()
148+ for record in caplog .records
149+ )
142150 assert has_nested_error == log_ref
143-
151+
144152 if log_ref :
145153 assert any ('Contribution 0' in record .message for record in caplog .records )
146154
@@ -153,11 +161,16 @@ def test_contributions_validation(self, caplog, has_nested_contributions: bool,
153161 (True , True , True ),
154162 ],
155163 )
156- def test_contribution_type_validation (self , caplog , set_contribution_type_on_main : bool ,
157- set_contribution_type_on_contrib : bool , log_ref : bool ):
164+ def test_contribution_type_validation (
165+ self ,
166+ caplog ,
167+ set_contribution_type_on_main : bool ,
168+ set_contribution_type_on_contrib : bool ,
169+ log_ref : bool ,
170+ ):
158171 """
159172 Test contribution_type validation during normalization.
160-
173+
161174 Args:
162175 set_contribution_type_on_main: Whether to set contribution_type on main property
163176 set_contribution_type_on_contrib: Whether to set contribution_type on contribution
@@ -166,18 +179,20 @@ def test_contribution_type_validation(self, caplog, set_contribution_type_on_mai
166179 main_property = DummyPhysicalProperty (source = 'simulation' , name = 'main' )
167180 if set_contribution_type_on_main :
168181 main_property .contribution_type = 'invalid_main_type'
169-
182+
170183 contribution = DummyPhysicalProperty (source = 'analysis' , name = 'contrib' )
171184 if set_contribution_type_on_contrib :
172185 contribution .contribution_type = 'valid_contrib_type'
173-
186+
174187 main_property .contributions = [contribution ]
175-
188+
176189 with caplog .at_level ('ERROR' ):
177190 main_property .normalize (EntryArchive (), logger )
178-
179- has_contrib_type_error = any ('contribution_type set but is not a contribution' in record .message .lower ()
180- for record in caplog .records )
191+
192+ has_contrib_type_error = any (
193+ 'contribution_type set but is not a contribution' in record .message .lower ()
194+ for record in caplog .records
195+ )
181196 assert has_contrib_type_error == log_ref
182197
183198 def test_is_contribution_method (self ):
@@ -186,11 +201,11 @@ def test_is_contribution_method(self):
186201 """
187202 main_property = DummyPhysicalProperty (source = 'simulation' , name = 'main' )
188203 contribution = DummyPhysicalProperty (source = 'analysis' , name = 'contrib' )
189-
204+
190205 assert not main_property ._is_contribution ()
191206 assert not contribution ._is_contribution ()
192-
207+
193208 main_property .contributions = [contribution ]
194209 main_property .normalize (EntryArchive (), logger )
195-
210+
196211 assert not main_property ._is_contribution ()
0 commit comments