Skip to content

Commit 18957cb

Browse files
committed
Tests: use NumPy to validate lists too; increase precision to 9 decimals.
1 parent a9c9105 commit 18957cb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/test_opendssdirect.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ def _assert_dict_equal(d1, d2, outer_key=None):
3939
v2 = d2[key]
4040
if isinstance(v1, dict):
4141
_assert_dict_equal_lkeys(v1, v2, outer_key=key)
42-
elif isinstance(v1, np.ndarray):
43-
np.testing.assert_array_almost_equal(v1, v2, err_msg=f'{outer_key}.{key}')
42+
elif isinstance(v1, np.ndarray) or (
43+
isinstance(v1, (list, tuple)) and
44+
(len(v1) > 0) and isinstance(v1[0], (float, int))
45+
):
46+
np.testing.assert_array_almost_equal(v1, v2, decimal=9, err_msg=f'{outer_key}.{key}')
4447
else:
4548
assert (v1 == v2), (outer_key, key, v1, v2)
4649

0 commit comments

Comments
 (0)