From 28c6ea7243019e8e83b589c7e0c686bad8f735fe Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2024 03:24:05 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit hooks --- src/diffpy/srmise/tests/test_dataclusters.py | 129 ++++++++++--------- 1 file changed, 65 insertions(+), 64 deletions(-) diff --git a/src/diffpy/srmise/tests/test_dataclusters.py b/src/diffpy/srmise/tests/test_dataclusters.py index eef300f..2a52ce6 100644 --- a/src/diffpy/srmise/tests/test_dataclusters.py +++ b/src/diffpy/srmise/tests/test_dataclusters.py @@ -1,6 +1,7 @@ from copy import copy -import pytest + import numpy as np +import pytest from diffpy.srmise.dataclusters import DataClusters @@ -42,76 +43,76 @@ def test___eq__(): # (produce ValueError & msg "Sequences x and y must have the same length.", something like that) # (6) Both x and y are empty array, and res is zero. + @pytest.mark.parametrize( - "inputs, expected", - [ - ( - # case (1) - { - "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), - ), - ( - # case (6) - { - "input_x": np.array([]), - "input_y": np.array([]), - "input_res": 0, - }, - DataClusters(np.array([]), np.array([]), 0), - ), - ], - ) + "inputs, expected", + [ + ( + # case (1) + { + "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), + ), + ( + # case (6) + { + "input_x": np.array([]), + "input_y": np.array([]), + "input_res": 0, + }, + DataClusters(np.array([]), np.array([]), 0), + ), + ], +) def test_set_data(inputs, expected): actual = DataClusters(x=inputs["input_x"], y=inputs["input_y"], res=inputs["input_res"]) assert actual == expected @pytest.mark.parametrize( - "inputs, msg", - [ - ( - # case (4) - { - "input_x": np.array([]), - "input_y": np.array([3, 2]), - "input_res": 4, - }, - "Sequences x and y must have the same length.", - ), - ( - # case (5) - { - "input_x": np.array([1, 2]), - "input_y": np.array([]), - "input_res": 4, - }, - "Sequences x and y must have the same length.", - ), - ( - # case (3) - { - "input_x": np.array([1]), - "input_y": np.array([3]), - "input_res": -1, - }, - "Resolution res must be non-negative.", - ), - ( - # case (2) - { - "input_x": np.array([1, 2, 3]), - "input_y": np.array([3, 2, 1]), - "input_res": 0, - }, - "Make trivial clustering, please make positive resolution.", - ), - ], - ) + "inputs, msg", + [ + ( + # case (4) + { + "input_x": np.array([]), + "input_y": np.array([3, 2]), + "input_res": 4, + }, + "Sequences x and y must have the same length.", + ), + ( + # case (5) + { + "input_x": np.array([1, 2]), + "input_y": np.array([]), + "input_res": 4, + }, + "Sequences x and y must have the same length.", + ), + ( + # case (3) + { + "input_x": np.array([1]), + "input_y": np.array([3]), + "input_res": -1, + }, + "Resolution res must be non-negative.", + ), + ( + # case (2) + { + "input_x": np.array([1, 2, 3]), + "input_y": np.array([3, 2, 1]), + "input_res": 0, + }, + "Make trivial clustering, please make positive resolution.", + ), + ], +) def test_set_data_order_bad(inputs, msg): with pytest.raises(ValueError, match=msg): DataClusters(x=inputs["input_x"], y=inputs["input_y"], res=inputs["input_res"]) -