(*args: Any, **kwargs: Any)
| 239 | """ |
| 240 | |
| 241 | def test(*args: Any, **kwargs: Any) -> None: |
| 242 | cases = list(fn(*args, **kwargs)) |
| 243 | expected_errors = set() |
| 244 | for c in cases: |
| 245 | if c.error is None: |
| 246 | continue |
| 247 | expected_error = c.error |
| 248 | if expected_error == "": |
| 249 | expected_error = TEST_MODULE_NAME |
| 250 | elif not expected_error.startswith(f"{TEST_MODULE_NAME}."): |
| 251 | expected_error = f"{TEST_MODULE_NAME}.{expected_error}" |
| 252 | assert expected_error not in expected_errors, ( |
| 253 | "collect_cases merges cases into a single stubtest invocation; we already " |
| 254 | "expect an error for {}".format(expected_error) |
| 255 | ) |
| 256 | expected_errors.add(expected_error) |
| 257 | output = run_stubtest( |
| 258 | stub="\n\n".join(textwrap.dedent(c.stub.lstrip("\n")) for c in cases), |
| 259 | runtime="\n\n".join(textwrap.dedent(c.runtime.lstrip("\n")) for c in cases), |
| 260 | options=["--generate-allowlist", "--strict-type-check-only"], |
| 261 | ) |
| 262 | |
| 263 | actual_errors = set(output.splitlines()) |
| 264 | if actual_errors != expected_errors: |
| 265 | output = run_stubtest( |
| 266 | stub="\n\n".join(textwrap.dedent(c.stub.lstrip("\n")) for c in cases), |
| 267 | runtime="\n\n".join(textwrap.dedent(c.runtime.lstrip("\n")) for c in cases), |
| 268 | options=[], |
| 269 | ) |
| 270 | assert actual_errors == expected_errors, output |
| 271 | |
| 272 | return test |
| 273 |
nothing calls this directly
no test coverage detected
searching dependent graphs…