Skip to content

Commit 7385ba9

Browse files
added comparison of grid points approximately using a sorted set
1 parent ca4482d commit 7385ba9

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/diffpy/labpdfproc/tests/test_functions.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,17 @@
22

33
from diffpy.labpdfproc.functions import Gridded_circle
44

5-
# Define test parameters
65
params1 = [
76
([0.5, 3, 1], {(0.0, -0.5), (0.0, 0.0), (0.5, 0.0), (-0.5, 0.0), (0.0, 0.5)}),
87
([1, 4, 1], {(-0.333333, -0.333333), (0.333333, -0.333333), (-0.333333, 0.333333), (0.333333, 0.333333)}),
98
]
109

1110

12-
# Define the test function
1311
@pytest.mark.parametrize("inputs, expected", params1)
1412
def test_get_grid_points(inputs, expected):
1513
expected_grid = expected
1614
actual_gs = Gridded_circle(radius=inputs[0], n_points_on_diameter=inputs[1], mu=inputs[2])
17-
assert actual_gs.grid == expected_grid
18-
19-
20-
# assert actual_gs.grid == pytest.approx(expected_grid)
21-
# for actual_point, expected_point in zip(actual_grid_sorted, expected_grid_sorted):
22-
# assert actual_point == pytest.approx(expected_point, rel=1e-4, abs=1e-6)
15+
actual_grid_sorted = sorted(actual_gs.grid)
16+
expected_grid_sorted = sorted(expected_grid)
17+
for actual_point, expected_point in zip(actual_grid_sorted, expected_grid_sorted):
18+
assert actual_point == pytest.approx(expected_point, rel=1e-4, abs=1e-6)

0 commit comments

Comments
 (0)