From 3c5366259b5c39a983aa9e23ba18c2a20827415c Mon Sep 17 00:00:00 2001 From: stevenhua0320 Date: Sun, 11 Aug 2024 01:01:44 +0800 Subject: [PATCH] add equal test method. --- src/diffpy/srmise/tests/test_dataclusters.py | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/diffpy/srmise/tests/test_dataclusters.py b/src/diffpy/srmise/tests/test_dataclusters.py index ecd243e..0205107 100644 --- a/src/diffpy/srmise/tests/test_dataclusters.py +++ b/src/diffpy/srmise/tests/test_dataclusters.py @@ -1,4 +1,5 @@ import numpy as np +import pytest from diffpy.srmise.dataclusters import DataClusters @@ -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