Skip to content

Commit 43d398f

Browse files
committed
changed test_write_dx_ValueError test
- only test numpy dtypes that always exist in a form that is not O/S or compiler dependent (see https://docs.scipy.org/doc/numpy/user/basics.types.html) - fix #51 - updated CHANGELOG
1 parent 18ae8aa commit 43d398f

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ The rules for this file:
2222
* Improved DX parsing speed (#2)
2323
* Fixed reading in DX files containing scientific notation (PR #52)
2424
* Added missing floordivision to Grid (PR #53)
25+
* fix test on ARM (#51)
2526

2627
Changes (do not affect user)
2728

gridData/tests/test_dx.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,19 @@ def test_write_dx(tmpdir, nptype, dxtype, counts=100, ndim=3):
6666

6767
assert_equal(out_dxtype, dxtype)
6868

69-
def test_write_dx_ValueError(tmpdir, nptype="longdouble", dxtype="unknown"):
69+
@pytest.mark.parametrize('nptype', ("complex64", "complex128", "bool_"))
70+
@pytest.mark.filterwarnings("ignore:array dtype.name =")
71+
def test_write_dx_ValueError(tmpdir, nptype, counts=100, ndim=3):
72+
h, edges = np.histogramdd(np.random.random((counts, ndim)), bins=10)
73+
g = Grid(h, edges)
74+
75+
# hack the grid to be a different dtype
76+
g.grid = g.grid.astype(nptype)
77+
7078
with pytest.raises(ValueError):
71-
test_write_dx(tmpdir, nptype, dxtype)
79+
with tmpdir.as_cwd():
80+
outfile = "grid.dx"
81+
g.export(outfile)
82+
83+
84+

0 commit comments

Comments
 (0)