MCPcopy Create free account
hub / github.com/dask/dask / test_stringify_path

Function test_stringify_path

dask/bytes/tests/test_bytes_utils.py:136–158  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

134
135
136def test_stringify_path():
137 test_filepath = os.path.join("path", "to", "file.txt")
138
139 # Pathlib.path
140 path = pathlib.Path(test_filepath)
141 assert stringify_path(path) == test_filepath
142
143 # fspath protocol
144 class CustomFSPath:
145 """For testing fspath on unknown objects"""
146
147 def __init__(self, path):
148 self.path = path
149
150 def __fspath__(self):
151 return self.path
152
153 path = CustomFSPath(test_filepath)
154 assert stringify_path(path) == test_filepath
155
156 # Non path-like input is unaffected
157 path = (1, 2, 3)
158 assert stringify_path(path) is path

Callers

nothing calls this directly

Calls 2

CustomFSPathClass · 0.85
joinMethod · 0.45

Tested by

no test coverage detected