@@ -13,64 +13,64 @@ def test_convert_sql_column_floats(self):
13
13
arr = np .array ([1.5 , None , 3 , 4.2 ], dtype = object )
14
14
result = lib .convert_sql_column (arr )
15
15
expected = np .array ([1.5 , np .nan , 3 , 4.2 ], dtype = 'f8' )
16
- self .assert_numpy_array_equal (result , expected )
16
+ tm .assert_numpy_array_equal (result , expected )
17
17
18
18
def test_convert_sql_column_strings (self ):
19
19
arr = np .array (['1.5' , None , '3' , '4.2' ], dtype = object )
20
20
result = lib .convert_sql_column (arr )
21
21
expected = np .array (['1.5' , np .nan , '3' , '4.2' ], dtype = object )
22
- self .assert_numpy_array_equal (result , expected )
22
+ tm .assert_numpy_array_equal (result , expected )
23
23
24
24
def test_convert_sql_column_unicode (self ):
25
25
arr = np .array ([u ('1.5' ), None , u ('3' ), u ('4.2' )],
26
26
dtype = object )
27
27
result = lib .convert_sql_column (arr )
28
28
expected = np .array ([u ('1.5' ), np .nan , u ('3' ), u ('4.2' )],
29
29
dtype = object )
30
- self .assert_numpy_array_equal (result , expected )
30
+ tm .assert_numpy_array_equal (result , expected )
31
31
32
32
def test_convert_sql_column_ints (self ):
33
33
arr = np .array ([1 , 2 , 3 , 4 ], dtype = 'O' )
34
34
arr2 = np .array ([1 , 2 , 3 , 4 ], dtype = 'i4' ).astype ('O' )
35
35
result = lib .convert_sql_column (arr )
36
36
result2 = lib .convert_sql_column (arr2 )
37
37
expected = np .array ([1 , 2 , 3 , 4 ], dtype = 'i8' )
38
- self .assert_numpy_array_equal (result , expected )
39
- self .assert_numpy_array_equal (result2 , expected )
38
+ tm .assert_numpy_array_equal (result , expected )
39
+ tm .assert_numpy_array_equal (result2 , expected )
40
40
41
41
arr = np .array ([1 , 2 , 3 , None , 4 ], dtype = 'O' )
42
42
result = lib .convert_sql_column (arr )
43
43
expected = np .array ([1 , 2 , 3 , np .nan , 4 ], dtype = 'f8' )
44
- self .assert_numpy_array_equal (result , expected )
44
+ tm .assert_numpy_array_equal (result , expected )
45
45
46
46
def test_convert_sql_column_longs (self ):
47
47
arr = np .array ([long (1 ), long (2 ), long (3 ), long (4 )], dtype = 'O' )
48
48
result = lib .convert_sql_column (arr )
49
49
expected = np .array ([1 , 2 , 3 , 4 ], dtype = 'i8' )
50
- self .assert_numpy_array_equal (result , expected )
50
+ tm .assert_numpy_array_equal (result , expected )
51
51
52
52
arr = np .array ([long (1 ), long (2 ), long (3 ), None , long (4 )], dtype = 'O' )
53
53
result = lib .convert_sql_column (arr )
54
54
expected = np .array ([1 , 2 , 3 , np .nan , 4 ], dtype = 'f8' )
55
- self .assert_numpy_array_equal (result , expected )
55
+ tm .assert_numpy_array_equal (result , expected )
56
56
57
57
def test_convert_sql_column_bools (self ):
58
58
arr = np .array ([True , False , True , False ], dtype = 'O' )
59
59
result = lib .convert_sql_column (arr )
60
60
expected = np .array ([True , False , True , False ], dtype = bool )
61
- self .assert_numpy_array_equal (result , expected )
61
+ tm .assert_numpy_array_equal (result , expected )
62
62
63
63
arr = np .array ([True , False , None , False ], dtype = 'O' )
64
64
result = lib .convert_sql_column (arr )
65
65
expected = np .array ([True , False , np .nan , False ], dtype = object )
66
- self .assert_numpy_array_equal (result , expected )
66
+ tm .assert_numpy_array_equal (result , expected )
67
67
68
68
def test_convert_sql_column_decimals (self ):
69
69
from decimal import Decimal
70
70
arr = np .array ([Decimal ('1.5' ), None , Decimal ('3' ), Decimal ('4.2' )])
71
71
result = lib .convert_sql_column (arr )
72
72
expected = np .array ([1.5 , np .nan , 3 , 4.2 ], dtype = 'f8' )
73
- self .assert_numpy_array_equal (result , expected )
73
+ tm .assert_numpy_array_equal (result , expected )
74
74
75
75
def test_convert_downcast_int64 (self ):
76
76
from pandas .io .libparsers import na_values
@@ -80,30 +80,30 @@ def test_convert_downcast_int64(self):
80
80
81
81
# default argument
82
82
result = lib .downcast_int64 (arr , na_values )
83
- self .assert_numpy_array_equal (result , expected )
83
+ tm .assert_numpy_array_equal (result , expected )
84
84
85
85
result = lib .downcast_int64 (arr , na_values , use_unsigned = False )
86
- self .assert_numpy_array_equal (result , expected )
86
+ tm .assert_numpy_array_equal (result , expected )
87
87
88
88
expected = np .array ([1 , 2 , 7 , 8 , 10 ], dtype = np .uint8 )
89
89
result = lib .downcast_int64 (arr , na_values , use_unsigned = True )
90
- self .assert_numpy_array_equal (result , expected )
90
+ tm .assert_numpy_array_equal (result , expected )
91
91
92
92
# still cast to int8 despite use_unsigned=True
93
93
# because of the negative number as an element
94
94
arr = np .array ([1 , 2 , - 7 , 8 , 10 ], dtype = np .int64 )
95
95
expected = np .array ([1 , 2 , - 7 , 8 , 10 ], dtype = np .int8 )
96
96
result = lib .downcast_int64 (arr , na_values , use_unsigned = True )
97
- self .assert_numpy_array_equal (result , expected )
97
+ tm .assert_numpy_array_equal (result , expected )
98
98
99
99
arr = np .array ([1 , 2 , 7 , 8 , 300 ], dtype = np .int64 )
100
100
expected = np .array ([1 , 2 , 7 , 8 , 300 ], dtype = np .int16 )
101
101
result = lib .downcast_int64 (arr , na_values )
102
- self .assert_numpy_array_equal (result , expected )
102
+ tm .assert_numpy_array_equal (result , expected )
103
103
104
104
int8_na = na_values [np .int8 ]
105
105
int64_na = na_values [np .int64 ]
106
106
arr = np .array ([int64_na , 2 , 3 , 10 , 15 ], dtype = np .int64 )
107
107
expected = np .array ([int8_na , 2 , 3 , 10 , 15 ], dtype = np .int8 )
108
108
result = lib .downcast_int64 (arr , na_values )
109
- self .assert_numpy_array_equal (result , expected )
109
+ tm .assert_numpy_array_equal (result , expected )
0 commit comments