Skip to content

Commit 9e29203

Browse files
Alison WuAlison Wu
authored andcommitted
used pathlib Path
1 parent 116f5c5 commit 9e29203

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ def datafile():
2525
base_path = Path(__file__).parent / "testdata" # Adjusted base path
2626

2727
def _load(filename):
28-
return str(base_path / filename)
28+
return base_path / filename
2929

3030
return _load

tests/diffpy/utils/parsers/test_serialization.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
from pathlib import Path
23

34
import numpy
45
import pytest
@@ -13,19 +14,18 @@ def test_load_multiple(tmp_path, datafile):
1314
targetjson = datafile("targetjson.json")
1415
generatedjson = tmp_path / "generated_serialization.json"
1516

16-
dbload_dir = os.path.dirname(datafile("dbload/e1.gr"))
17-
tlm_list = sorted(os.listdir(dbload_dir))
17+
dbload_dir = datafile("dbload")
18+
tlm_list = sorted(dbload_dir.glob("*.gr"))
1819

1920
generated_data = None
20-
for hfname in tlm_list:
21+
for headerfile in tlm_list:
2122
# gather data using loadData
22-
headerfile = os.path.join(dbload_dir, hfname)
2323
hdata = loadData(headerfile, headers=True)
2424
data_table = loadData(headerfile)
2525

2626
# check path extraction
2727
generated_data = serialize_data(headerfile, hdata, data_table, dt_colnames=["r", "gr"], show_path=True)
28-
assert headerfile == os.path.normpath(generated_data[hfname].pop("path"))
28+
assert headerfile == Path(generated_data[headerfile.name].pop("path"))
2929

3030
# rerun without path information and save to file
3131
generated_data = serialize_data(

0 commit comments

Comments
 (0)