(tmp_path)
| 697 | |
| 698 | |
| 699 | def test_parse_file(tmp_path): |
| 700 | path = tmp_path / 'test.json' |
| 701 | path.write_text('{"x": 12}') |
| 702 | with pytest.warns(PydanticDeprecatedSince20) as all_warnings: |
| 703 | assert SimpleModel.parse_file(str(path)).model_dump() == {'x': 12} |
| 704 | assert len(all_warnings) == 4 |
| 705 | expected_warnings = [ |
| 706 | 'The `parse_file` method is deprecated; load the data from file, then if your data is JSON use `model_validate_json`, otherwise `model_validate` instead', |
| 707 | '`load_file` is deprecated', |
| 708 | '`load_str_bytes` is deprecated', |
| 709 | 'The `parse_obj` method is deprecated; use `model_validate` instead', |
| 710 | ] |
| 711 | assert [w.message.message for w in all_warnings] == expected_warnings |
| 712 | |
| 713 | |
| 714 | def test_construct(): |
nothing calls this directly
no test coverage detected