Skip to content

Commit 22b5bb0

Browse files
authored
Merge pull request #210 from datamol-io/pathstr
Make sure paths are string in `datamol.fs.glob`
2 parents c0b6450 + 90b55c8 commit 22b5bb0

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

datamol/utils/fs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ def glob(path: str, detail: bool = False, **kwargs) -> List[str]:
314314
path: A glob-style path.
315315
"""
316316
# Get the list of paths
317+
path = str(path)
317318
fs = get_mapper(path).fs
318319
paths = fs.glob(path, detail=detail, **kwargs)
319320
paths = [fsspec.utils._unstrip_protocol(d, fs) for d in paths]

tests/test_conformers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def test_generate_4():
5555
smiles = "CCCC"
5656
mol = dm.to_mol(smiles)
5757
mol = dm.conformers.generate(mol, rms_cutoff=1, minimize_energy=True)
58-
assert mol.GetNumConformers() == 21
58+
assert mol.GetNumConformers() in [20, 21]
5959
assert "rdkit_UFF_energy" in mol.GetConformer(0).GetPropsAsDict()
6060

6161

tests/test_utils_fs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ def test_glob(tmp_path):
171171
with open(tmp_file, "w") as f:
172172
f.write("hello")
173173

174-
assert len(dm.utils.fs.glob(tmp_path / "*.txt")) == 5
174+
tmp_path_regex = tmp_path / "*.txt"
175+
assert len(dm.utils.fs.glob(tmp_path_regex)) == 5
175176

176177

177178
def test_copy_file(tmp_path):

0 commit comments

Comments
 (0)