(self, value: Any)
| 513 | self._set(method, Mock(wraps=getattr(self, method))) |
| 514 | |
| 515 | def _normalize(self, value: Any) -> Iterator[Any]: |
| 516 | # First turn everything into an iterable |
| 517 | if not hasattr(value, "__iter__") or isinstance(value, str): |
| 518 | value = [value] |
| 519 | # Then turn everything within into a Result |
| 520 | results = [] |
| 521 | for obj in value: |
| 522 | if isinstance(obj, bool): |
| 523 | obj = Result(exited=0 if obj else 1) |
| 524 | elif isinstance(obj, str): |
| 525 | obj = Result(obj) |
| 526 | results.append(obj) |
| 527 | # Finally, turn that iterable into an iteratOR, depending on repeat |
| 528 | return cycle(results) if getattr(self, "__repeat") else iter(results) |
| 529 | |
| 530 | # TODO: _maybe_ make this more metaprogrammy/flexible (using __call__ etc)? |
| 531 | # Pretty worried it'd cause more hard-to-debug issues than it's presently |
no test coverage detected