Skip to content

Commit

Permalink
fix coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Sep 18, 2019
1 parent fb9d58c commit 4833171
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pydantic/validators.py
Expand Up @@ -364,7 +364,7 @@ def path_validator(v: Any) -> Path:

try:
return Path(v)
except ValueError as e:
except (ValueError, TypeError) as e:
raise errors.PathError() from e


Expand Down
4 changes: 2 additions & 2 deletions tests/test_types.py
Expand Up @@ -1282,9 +1282,9 @@ class Model(BaseModel):
foo: Path

with pytest.raises(ValidationError) as exc_info:
Model(foo=None)
Model(foo=123)
assert exc_info.value.errors() == [
{'loc': ('foo',), 'msg': 'none is not an allowed value', 'type': 'type_error.none.not_allowed'}
{'loc': ('foo',), 'msg': 'expected str, bytes or os.PathLike object, not int', 'type': 'type_error'}
]


Expand Down

0 comments on commit 4833171

Please sign in to comment.