(self, silent_if_no_results=False, filt=None, _offset=0)
| 223 | return [c.get_result() for c in self._with_result()] |
| 224 | |
| 225 | def formatted_string(self, silent_if_no_results=False, filt=None, _offset=0) -> str: |
| 226 | sets = filter(lambda c: isinstance(c, CompareCheckSet), self._with_result()) |
| 227 | checks = filter(lambda c: isinstance(c, CompareCheck), self._with_result()) |
| 228 | checks = sorted(checks, key=lambda c: norm(c.get_result().diff), reverse=True) |
| 229 | |
| 230 | if filt is None: |
| 231 | filt = self.filt |
| 232 | |
| 233 | checks = filter(lambda c: filt(c.get_result()), checks) |
| 234 | |
| 235 | sets = list(sets) |
| 236 | checks = list(checks) |
| 237 | |
| 238 | no_results = not checks and not sets |
| 239 | if silent_if_no_results and no_results: |
| 240 | return "" |
| 241 | |
| 242 | head = [ |
| 243 | f"{' ' * _offset}Check set[{self.name}]:", |
| 244 | ] |
| 245 | |
| 246 | lines = [] |
| 247 | if no_results: |
| 248 | lines.append(f"{' ' * (_offset + 2)}No results.") |
| 249 | |
| 250 | for c in checks: |
| 251 | s = c.formatted_string(silent_if_no_results, filt, _offset + 2) |
| 252 | if s: |
| 253 | lines.append(f"{' ' * (_offset + 2)}{s}") |
| 254 | |
| 255 | for s in sets: |
| 256 | s = s.formatted_string(silent_if_no_results, filt, _offset + 2) |
| 257 | if s: |
| 258 | lines.append(s) |
| 259 | |
| 260 | if not lines: |
| 261 | return "" |
| 262 | |
| 263 | head += lines |
| 264 | return "\n".join(head) + "\n" |
| 265 | |
| 266 | def _with_result(self): |
| 267 | return (c for c in self.checks if c.get_result() is not None) |
nothing calls this directly
no test coverage detected