33from __future__ import (absolute_import , division , print_function ,
44 unicode_literals )
55
6+ from distutils .version import LooseVersion
7+
68import pytest
79import numpy as np
810
1214import unittest
1315
1416
17+ needs_new_numpy = pytest .mark .xfail (
18+ LooseVersion (np .__version__ ) < LooseVersion ('1.8.0' ),
19+ reason = 'NumPy < 1.8.0 is broken.' )
20+
21+
1522class TestUnitData (object ):
1623 testdata = [("hello world" , ["hello world" ], [0 ]),
1724 ("Здравствуйте мир" , ["Здравствуйте мир" ], [0 ]),
@@ -21,12 +28,14 @@ class TestUnitData(object):
2128
2229 ids = ["single" , "unicode" , "mixed" ]
2330
31+ @needs_new_numpy
2432 @pytest .mark .parametrize ("data, seq, locs" , testdata , ids = ids )
2533 def test_unit (self , data , seq , locs ):
2634 act = cat .UnitData (data )
2735 assert act .seq == seq
2836 assert act .locs == locs
2937
38+ @needs_new_numpy
3039 def test_update_map (self ):
3140 data = ['a' , 'd' ]
3241 oseq = ['a' , 'd' ]
@@ -78,6 +87,7 @@ class TestStrCategoryConverter(object):
7887 def mock_axis (self , request ):
7988 self .cc = cat .StrCategoryConverter ()
8089
90+ @needs_new_numpy
8191 @pytest .mark .parametrize ("data, unitmap, exp" , testdata , ids = ids )
8292 def test_convert (self , data , unitmap , exp ):
8393 MUD = MockUnitData (unitmap )
0 commit comments