From 645e7697044416978585cd5b78557ec307cf4059 Mon Sep 17 00:00:00 2001 From: sgbaird Date: Sat, 1 Jul 2023 01:55:52 -0400 Subject: [PATCH] fixup lower_tri test This is why hardcoded (and manually checked) answers for tests would make sense. The unit test was wrong here --- tests/customization_test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/customization_test.py b/tests/customization_test.py index e06b83f..a588e94 100644 --- a/tests/customization_test.py +++ b/tests/customization_test.py @@ -119,8 +119,10 @@ def test_distance_mask(): def test_lower_tri_mask(): xc = XtalConverter(mask_types=["lower_tri"]) imgs = xc.xtal2png(example_structures) - if not np.all(xc.data[np.tril(xc.data[0, 0])] == 0): - raise ValueError("Lower triangle mask not applied correctly") + for d in xc.data: + for sq in d: + if not np.all(sq[np.tril_indices(sq.shape[0])] == 0): + raise ValueError("Lower triangle mask not applied correctly") return imgs