3
3
from __future__ import (absolute_import , division , print_function ,
4
4
unicode_literals )
5
5
6
+ from distutils .version import LooseVersion
7
+
6
8
import pytest
7
9
import numpy as np
8
10
12
14
import unittest
13
15
14
16
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
+
15
22
class TestUnitData (object ):
16
23
testdata = [("hello world" , ["hello world" ], [0 ]),
17
24
("Здравствуйте мир" , ["Здравствуйте мир" ], [0 ]),
@@ -21,12 +28,14 @@ class TestUnitData(object):
21
28
22
29
ids = ["single" , "unicode" , "mixed" ]
23
30
31
+ @needs_new_numpy
24
32
@pytest .mark .parametrize ("data, seq, locs" , testdata , ids = ids )
25
33
def test_unit (self , data , seq , locs ):
26
34
act = cat .UnitData (data )
27
35
assert act .seq == seq
28
36
assert act .locs == locs
29
37
38
+ @needs_new_numpy
30
39
def test_update_map (self ):
31
40
data = ['a' , 'd' ]
32
41
oseq = ['a' , 'd' ]
@@ -78,6 +87,7 @@ class TestStrCategoryConverter(object):
78
87
def mock_axis (self , request ):
79
88
self .cc = cat .StrCategoryConverter ()
80
89
90
+ @needs_new_numpy
81
91
@pytest .mark .parametrize ("data, unitmap, exp" , testdata , ids = ids )
82
92
def test_convert (self , data , unitmap , exp ):
83
93
MUD = MockUnitData (unitmap )
0 commit comments