|
25 | 25 | from numpy.testing import (assert_array_equal, assert_almost_equal, dec)
|
26 | 26 |
|
27 | 27 |
|
| 28 | +# Dtypes for testing coordinate map creation / processing |
| 29 | +_SYMPY_SAFE_DTYPES = (np.sctypes['int'] + np.sctypes['uint'] + |
| 30 | + np.sctypes['float'] + np.sctypes['complex'] + |
| 31 | + [np.object]) |
| 32 | +# Sympy <= 1.1 does not handle numpy longcomplex correctly. See: |
| 33 | +# https://github.com/sympy/sympy/pull/12901 |
| 34 | +_SYMPY_SAFE_DTYPES.remove(np.longcomplex) |
| 35 | + |
| 36 | + |
28 | 37 | class empty(object):
|
29 | 38 | pass
|
30 | 39 |
|
@@ -939,15 +948,10 @@ def test_make_cmap():
|
939 | 948 | def test_dtype_cmap_inverses():
|
940 | 949 | # Check that we can make functional inverses of AffineTransforms, and
|
941 | 950 | # CoordinateMap versions of AffineTransforms
|
942 |
| - dtypes = (np.sctypes['int'] + np.sctypes['uint'] + np.sctypes['float'] |
943 |
| - + np.sctypes['complex'] + [np.object]) |
944 |
| - # Sympy <= 1.1 does not handle numpy longcomplex correctly. See: |
945 |
| - # https://github.com/sympy/sympy/pull/12901 |
946 |
| - dtypes.remove(np.longcomplex) |
947 | 951 | arr_p1 = np.eye(4)[:, [0, 2, 1, 3]]
|
948 | 952 | in_list = [0, 1, 2]
|
949 | 953 | out_list = [0, 2, 1]
|
950 |
| - for dt in dtypes: |
| 954 | + for dt in _SYMPY_SAFE_DTYPES: |
951 | 955 | in_cs = CoordinateSystem('ijk', coord_dtype=dt)
|
952 | 956 | out_cs = CoordinateSystem('xyz', coord_dtype=dt)
|
953 | 957 | cmap = AffineTransform(in_cs, out_cs, arr_p1.astype(dt))
|
@@ -1031,11 +1035,9 @@ def test_cmap_coord_types():
|
1031 | 1035 | # Check that we can use full range of coordinate system types. The inverse
|
1032 | 1036 | # of an AffineTransform should generate coordinates in the input coordinate
|
1033 | 1037 | # system dtype
|
1034 |
| - dtypes = (np.sctypes['int'] + np.sctypes['uint'] + np.sctypes['float'] |
1035 |
| - + np.sctypes['complex'] + [np.object]) |
1036 | 1038 | arr_p1 = np.eye(4)
|
1037 | 1039 | arr_p1[:3, 3] = 1
|
1038 |
| - for dt in dtypes: |
| 1040 | + for dt in _SYMPY_SAFE_DTYPES: |
1039 | 1041 | in_cs = CoordinateSystem('ijk', coord_dtype=dt)
|
1040 | 1042 | out_cs = CoordinateSystem('xyz', coord_dtype=dt)
|
1041 | 1043 | # CoordinateMap
|
|
0 commit comments