| 346 | |
| 347 | |
| 348 | def test_func_doc_deprecated_args(ctx: Context): |
| 349 | field = Field( |
| 350 | String, |
| 351 | { |
| 352 | "path": Argument(NonNull(String)), |
| 353 | "configDir": Argument( |
| 354 | String, |
| 355 | deprecation_reason="Use `configPath` instead.", |
| 356 | ), |
| 357 | }, |
| 358 | deprecation_reason="Use apply_config instead.", |
| 359 | ) |
| 360 | |
| 361 | parent = Object("Container", lambda: {"apply": field}) |
| 362 | handler = _ObjectField(ctx, "apply", field, parent) |
| 363 | |
| 364 | docstring = handler.func_doc() |
| 365 | |
| 366 | assert "Parameters" in docstring |
| 367 | assert ".. deprecated::\n Use apply_config instead." in docstring |
| 368 | doc_lines = {line.strip() for line in docstring.splitlines()} |
| 369 | assert "config_dir:" in doc_lines |
| 370 | assert ".. deprecated:: Use config_path instead." in doc_lines |
| 371 | |
| 372 | body = handler.func_body() |
| 373 | normalized = body.replace('\\"', '"') |
| 374 | assert 'Method "apply" is deprecated: Use apply_config instead.' in normalized |
| 375 | |
| 376 | |
| 377 | def test_interface_methods_deprecated(ctx: Context): |