| 123 | return contracts |
| 124 | |
| 125 | def from_spider(self, spider: Spider, results: TestResult) -> list[Request | None]: |
| 126 | requests: list[Request | None] = [] |
| 127 | for method in self.tested_methods_from_spidercls(type(spider)): |
| 128 | bound_method = getattr(spider, method) |
| 129 | try: |
| 130 | requests.append(self.from_method(bound_method, results)) |
| 131 | except Exception: |
| 132 | case = _create_testcase(bound_method, "contract") |
| 133 | results.addError(case, sys.exc_info()) |
| 134 | |
| 135 | return requests |
| 136 | |
| 137 | def from_method( |
| 138 | self, method: Callable[..., Any], results: TestResult |