Skip to content

Commit

Permalink
windows can't do <U as a path even hypothetically
Browse files Browse the repository at this point in the history
  • Loading branch information
sneakers-the-rat committed Oct 11, 2024
1 parent 2991d36 commit d9f785e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/numpydantic/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _relativize_paths(
``relative_to`` directory, if provided in the context
"""
relative_to = Path(relative_to).resolve()

def _r_path(v: Any) -> Any:
if not isinstance(v, (str, Path)):
return v
Expand All @@ -80,7 +80,7 @@ def _r_path(v: Any) -> Any:
):
return v
return str(relative_path(path, relative_to))
except (TypeError, ValueError):
except (TypeError, ValueError, OSError):
return v

return _walk_and_apply(value, _r_path, skip)
Expand All @@ -95,7 +95,7 @@ def _a_path(v: Any) -> Any:
if not path.exists():
return v
return str(path.resolve())
except (TypeError, ValueError):
except (TypeError, ValueError, OSError):
return v

return _walk_and_apply(value, _a_path, skip)
Expand Down
4 changes: 4 additions & 0 deletions tests/test_interface/test_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import json
import pdb
from importlib.metadata import version

import dask.array as da
Expand Down Expand Up @@ -98,6 +99,9 @@ def test_interface_roundtrip_json(dtype_by_interface, tmp_output_dir_func):
if "subclass" in dtype_by_interface.id.lower():
pytest.xfail()

if "str-str" in dtype_by_interface.id.lower():
pdb.set_trace()

array = dtype_by_interface.array(path=tmp_output_dir_func)
case = dtype_by_interface.model(array=array)

Expand Down

0 comments on commit d9f785e

Please sign in to comment.