Пример #1
0
 def test_validate_path_type_error(self) -> None:
     """Test _validate_path raise TypeError."""
     with pytest.raises(TypeError):
         BaseModel._validate_path(13)
Пример #2
0
 def test_validate_path_value_error(self, tmp_path: Path) -> None:
     """Test _validate_path raise ValueError."""
     with pytest.raises(ValueError):
         BaseModel._validate_path(tmp_path / "missing", must_exist=True)
Пример #3
0
 def test_validate_path(self, tmp_path: Path) -> None:
     """Test validate_path."""
     assert BaseModel._validate_path(str(tmp_path)) == tmp_path
     assert BaseModel._validate_path(str(tmp_path), must_exist=True) == tmp_path
     assert BaseModel._validate_path(tmp_path) == tmp_path
     assert BaseModel._validate_path(tmp_path, must_exist=True) == tmp_path