From cca6a924fdc2bed1a0f814b0a156685b3b0e9cbc Mon Sep 17 00:00:00 2001 From: Ryuichi Arafune Date: Thu, 11 Jan 2024 17:22:50 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=20add=20test=20for=20bz.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_bz.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 tests/test_bz.py diff --git a/tests/test_bz.py b/tests/test_bz.py new file mode 100644 index 00000000..727b6d09 --- /dev/null +++ b/tests/test_bz.py @@ -0,0 +1,58 @@ +"""Test for utilitiy.bz.""" + + +import numpy as np +import pytest + +from arpes.utilities import bz + + +def test_as_3d() -> None: + """Test for 'bz.as_3d'.""" + points_2d = np.array([[0, 1], [2, 3]]) + np.testing.assert_array_equal(bz.as_3d(points_2d), np.array([[0, 1, 0], [2, 3, 0]])) + + +def test_as_2d() -> None: + """Test for ''bz.as_2d'.""" + points_3d = np.array([[0, 1, 2], [2, 3, 4]]) + np.testing.assert_array_equal(bz.as_2d(points_3d), np.array([[0, 1], [2, 3]])) + + +def test_orthorombic_cell() -> None: + """Test for orthormbic_cell function.""" + np.testing.assert_array_equal( + bz.orthorhombic_cell(5.4, 2.3, 3.0), + np.array( + [[5.4, 0, 0], [0, 2.3, 0], [0, 0, 3.0]], + ), + ) + + +def test_hex_cell() -> None: + """Test for hex cell function.""" + np.testing.assert_array_equal( + bz.hex_cell(3.0, 4.0), + np.array( + [ + [3.0, 0.0, 0.0], + [-1.5, 2.598076211353316, 0], + [0, 0, 4.0], + ], + ), + ) + + np.testing.assert_array_equal( + bz.hex_cell_2d(3.0), + np.array( + [ + [3.0, 0.0], + [-1.5, 2.598076211353316], + ], + ), + ) + + # def test_single_path() -> None: + # """Test for parse_single_path.""" + # path = "GKM" + # assert bz.parse_single_path(path) == [[0, 0, 0], [1, 2, 3], [3, 4, 5]]