Skip to content

Commit cbf7a46

Browse files
authored
Merge pull request #42 from yucongalicechen/input_dir
update fixture
2 parents fcbe6ba + bb60498 commit cbf7a46

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

src/diffpy/labpdfproc/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from diffpy.utils.scattering_objects.diffraction_objects import Diffraction_object
66

77
RADIUS_MM = 1
8-
N_POINTS_ON_DIAMETER = 249
8+
N_POINTS_ON_DIAMETER = 300
99
TTH_GRID = np.arange(1, 141, 1)
1010

1111

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import os
2+
from pathlib import Path
3+
4+
import pytest
5+
6+
7+
@pytest.fixture
8+
def user_filesystem(tmp_path):
9+
directory = Path(tmp_path)
10+
os.chdir(directory)
11+
12+
input_dir = Path(tmp_path).resolve() / "input_dir"
13+
input_dir.mkdir(parents=True, exist_ok=True)
14+
15+
chi_data = "dataformat = twotheta\n mode = xray\n # chi_Q chi_I\n 1 2\n 3 4\n 5 6\n 7 8\n"
16+
xy_data = "1 2\n 3 4\n 5 6\n 7 8"
17+
unreadable_data = "This is an unreadable file."
18+
binary_data = b"\x00\x01\x02\x03\x04"
19+
20+
with open("good_data.chi", "w") as f:
21+
f.write(chi_data)
22+
with open("good_data.xy", "w") as f:
23+
f.write(xy_data)
24+
with open("good_data.txt", "w") as f:
25+
f.write(chi_data)
26+
with open("unreadable_file.txt", "w") as f:
27+
f.write(unreadable_data)
28+
with open("binary.pkl", "wb") as f:
29+
f.write(binary_data)
30+
31+
with open(os.path.join(input_dir, "good_data.chi"), "w") as f:
32+
f.write(chi_data)
33+
with open(os.path.join(input_dir, "good_data.xy"), "w") as f:
34+
f.write(xy_data)
35+
with open(os.path.join(input_dir, "good_data.txt"), "w") as f:
36+
f.write(chi_data)
37+
with open(os.path.join(input_dir, "unreadable_file.txt"), "w") as f:
38+
f.write(unreadable_data)
39+
with open(os.path.join(input_dir, "binary.pkl"), "wb") as f:
40+
f.write(binary_data)
41+
42+
yield tmp_path

0 commit comments

Comments
 (0)