6
6
# beginnings of a test suite.
7
7
8
8
from numpy .testing import TestCase , assert_almost_equal
9
- from unittest import SkipTest
9
+
10
+ try :
11
+ from unittest import skipIf
12
+ except ImportError :
13
+ # for new features, fallback to unittest backport for Python 2.4 - 2.6
14
+ from unittest2 import skipIf
10
15
11
16
# For Python 3.x this will be true
12
17
PY3 = (sys .version_info [0 ] == 3 )
@@ -154,7 +159,8 @@ def test_less_than_n_by_3_points_should_work(self):
154
159
lonsout = bm .shiftdata (lonsin [:, :2 ])
155
160
assert_almost_equal (lonsout_expected , lonsout )
156
161
157
-
162
+ @skipIf (PY3 and pyproj .__version__ <= "1.9.4" ,
163
+ "Test skipped in Python 3.x with pyproj version 1.9.4 and below." )
158
164
class TestProjectCoords (TestCase ):
159
165
def get_data (self ):
160
166
lons , lats = np .arange (- 180 , 180 , 20 ), np .arange (- 90 , 90 , 10 )
@@ -167,10 +173,6 @@ def test_convert(self):
167
173
"""
168
174
Should not fail on C non-contiguous arrays
169
175
"""
170
- # skip test for Python 3.x and pyproj 1.9.4 or less
171
- if PY3 and pyproj .__version__ <= "1.9.4" :
172
- raise SkipTest ("Test skipped in Python 3.x with pyproj version 1.9.4 and below." )
173
-
174
176
lons , lats , bmp = self .get_data ()
175
177
assert not lons .flags ['C_CONTIGUOUS' ]
176
178
assert isinstance (lons , np .ndarray )
@@ -180,10 +182,6 @@ def test_convert(self):
180
182
181
183
182
184
def test_results_should_be_same_for_c_and_f_order_arrays (self ):
183
- # skip test for Python 3.x and pyproj 1.9.4 or less
184
- if PY3 and pyproj .__version__ <= "1.9.4" :
185
- raise SkipTest ("Test skipped in Python 3.x with pyproj version 1.9.4 and below." )
186
-
187
185
lons , lats , bmp = self .get_data ()
188
186
189
187
xx1 , yy1 = bmp (lons .copy (order = "C" ), lats .copy (order = "C" ))
0 commit comments