@@ -1077,19 +1077,21 @@ class TestGroupVarFloat32(GroupVarTestMixin):
1077
1077
1078
1078
class TestHashTable (object ):
1079
1079
1080
- def test_lookup_nan (self ):
1080
+ @pytest .mark .parametrize ('writable' , [True , False ])
1081
+ def test_lookup_nan (self , writable ):
1081
1082
xs = np .array ([2.718 , 3.14 , np .nan , - 7 , 5 , 2 , 3 ])
1082
1083
# GH 21688 ensure we can deal with readonly memory views
1083
- xs .setflags (write = False )
1084
+ xs .setflags (write = writable )
1084
1085
m = ht .Float64HashTable ()
1085
1086
m .map_locations (xs )
1086
1087
tm .assert_numpy_array_equal (m .lookup (xs ), np .arange (len (xs ),
1087
1088
dtype = np .int64 ))
1088
1089
1089
- def test_lookup_overflow (self ):
1090
+ @pytest .mark .parametrize ('writable' , [True , False ])
1091
+ def test_lookup_overflow (self , writable ):
1090
1092
xs = np .array ([1 , 2 , 2 ** 63 ], dtype = np .uint64 )
1091
1093
# GH 21688 ensure we can deal with readonly memory views
1092
- xs .setflags (write = False )
1094
+ xs .setflags (write = writable )
1093
1095
m = ht .UInt64HashTable ()
1094
1096
m .map_locations (xs )
1095
1097
tm .assert_numpy_array_equal (m .lookup (xs ), np .arange (len (xs ),
@@ -1100,14 +1102,15 @@ def test_get_unique(self):
1100
1102
exp = np .array ([1 , 2 , 2 ** 63 ], dtype = np .uint64 )
1101
1103
tm .assert_numpy_array_equal (s .unique (), exp )
1102
1104
1103
- def test_vector_resize (self ):
1105
+ @pytest .mark .parametrize ('writable' , [True , False ])
1106
+ def test_vector_resize (self , writable ):
1104
1107
# Test for memory errors after internal vector
1105
1108
# reallocations (pull request #7157)
1106
1109
1107
1110
def _test_vector_resize (htable , uniques , dtype , nvals , safely_resizes ):
1108
1111
vals = np .array (np .random .randn (1000 ), dtype = dtype )
1109
1112
# GH 21688 ensure we can deal with readonly memory views
1110
- vals .setflags (write = False )
1113
+ vals .setflags (write = writable )
1111
1114
# get_labels may append to uniques
1112
1115
htable .get_labels (vals [:nvals ], uniques , 0 , - 1 )
1113
1116
# to_array() set an external_view_exists flag on uniques.
0 commit comments