66# beginnings of a test suite.
77
88from 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
1015
1116# For Python 3.x this will be true
1217PY3 = (sys .version_info [0 ] == 3 )
@@ -154,7 +159,8 @@ def test_less_than_n_by_3_points_should_work(self):
154159 lonsout = bm .shiftdata (lonsin [:, :2 ])
155160 assert_almost_equal (lonsout_expected , lonsout )
156161
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." )
158164class TestProjectCoords (TestCase ):
159165 def get_data (self ):
160166 lons , lats = np .arange (- 180 , 180 , 20 ), np .arange (- 90 , 90 , 10 )
@@ -167,10 +173,6 @@ def test_convert(self):
167173 """
168174 Should not fail on C non-contiguous arrays
169175 """
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-
174176 lons , lats , bmp = self .get_data ()
175177 assert not lons .flags ['C_CONTIGUOUS' ]
176178 assert isinstance (lons , np .ndarray )
@@ -180,10 +182,6 @@ def test_convert(self):
180182
181183
182184 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-
187185 lons , lats , bmp = self .get_data ()
188186
189187 xx1 , yy1 = bmp (lons .copy (order = "C" ), lats .copy (order = "C" ))
0 commit comments