Skip to content

Commit 30fdc6b

Browse files
committed
Adds test for relative path
1 parent c021d8f commit 30fdc6b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/test_models.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Test the pydantic models."""
22

3+
import pathlib
34
import re
45
from typing import Callable
56

@@ -100,6 +101,13 @@ def test_initialise_with_extra_fields(self, model: Callable, model_params: dict)
100101
model(new_field=1, **model_params)
101102

102103

104+
def test_custom_file_path_is_absolute() -> None:
105+
"""If we use provide a relative path to the custom file model, it should be converted to an absolute path."""
106+
relative_path = pathlib.Path("./relative_path")
107+
custom_file = RATapi.models.CustomFile(path=relative_path)
108+
assert custom_file.path.is_absolute()
109+
110+
103111
def test_data_eq() -> None:
104112
"""If we use the Data.__eq__ method with an object that is not a pydantic BaseModel, we should return
105113
"NotImplemented".

0 commit comments

Comments
 (0)