Skip to content

Commit

Permalink
add equal test method.
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenhua0320 committed Aug 10, 2024
1 parent 89c8c0b commit 3c53662
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/diffpy/srmise/tests/test_dataclusters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np
import pytest

from diffpy.srmise.dataclusters import DataClusters

Expand All @@ -10,3 +11,29 @@ def test_clear():
# Perform the clear operation
actual.clear()
assert actual == expected


@pytest.mark.parametrize(
"inputs, expected",
[
(
{
"input_x": np.array([1, 2, 3]),
"input_y": np.array([3, 2, 1]),
"input_res": 4,
},
DataClusters(np.array([1, 2, 3]), np.array([3, 2, 1]), 4),
),
(
{
"input_x": np.array([]),
"input_y": np.array([]),
"input_res": 0,
},
DataClusters(np.array([]), np.array([]), 0),
),
],
)
def test_equal(inputs, expected):
actual = DataClusters(x=inputs["input_x"], y=inputs["input_y"], res=inputs["input_res"])
assert actual == expected

0 comments on commit 3c53662

Please sign in to comment.