Changeset c713c85 in sasmodels
- Timestamp:
- Feb 27, 2017 6:44:20 PM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- e09d1e0
- Parents:
- 5124c969
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/model_test.py
r479d0f3 rc713c85 181 181 self.run_one(model, test) 182 182 183 if not tests and self.platform == "dll": 183 # Check for missing tests. Only do so for the "dll" tests 184 # to reduce noise from both opencl and dll, and because 185 # python kernels use platform="dll". 186 if self.platform == "dll": 187 missing = [] 184 188 ## Uncomment the following to make forgetting the test 185 ## values an error. Only do so for the "dll" tests 186 ## to reduce noise from both opencl and dll, and because 187 ## python kernels use platform="dll". 188 #raise Exception("No test cases provided") 189 pass 189 ## an error 190 missing = self._find_missing_tests() 191 if missing: 192 raise ValueError("Missing tests for "+", ".join(missing)) 190 193 191 194 except: 192 195 annotate_exception(self.test_name) 193 196 raise 197 198 def _find_missing_tests(self): 199 # type: () -> None 200 """make sure there are 1D, 2D, ER and VR tests as appropriate""" 201 model_has_VR = callable(self.info.VR) 202 model_has_ER = callable(self.info.ER) 203 model_has_1D = True 204 model_has_2D = any(p.type == 'orientation' 205 for p in self.info.parameters.kernel_parameters) 206 207 # Lists of tests that have a result that is not None 208 single = [test for test in self.info.tests 209 if not isinstance(test[2], list) and test[2] is not None] 210 tests_has_VR = any(test[1] == 'VR' for test in single) 211 tests_has_ER = any(test[1] == 'ER' for test in single) 212 tests_has_1D_single = any(isinstance(test[1], float) for test in single) 213 tests_has_2D_single = any(isinstance(test[1], tuple) for test in single) 214 215 multiple = [test for test in self.info.tests 216 if isinstance(test[2], list) 217 and not all(result is None for result in test[2])] 218 tests_has_1D_multiple = any(isinstance(test[1][0], float) 219 for test in multiple) 220 tests_has_2D_multiple = any(isinstance(test[1][0], tuple) 221 for test in multiple) 222 223 missing = [] 224 if model_has_VR and not tests_has_VR: 225 missing.append("VR") 226 if model_has_ER and not tests_has_ER: 227 missing.append("ER") 228 if model_has_1D and not (tests_has_1D_single or tests_has_1D_multiple): 229 missing.append("1D") 230 if model_has_2D and not (tests_has_2D_single or tests_has_2D_multiple): 231 missing.append("2D") 232 233 return missing 194 234 195 235 def run_one(self, model, test):
Note: See TracChangeset
for help on using the changeset viewer.