@@ -1704,20 +1704,25 @@ def test_unique_complex_numbers(self, array, expected):
1704
1704
1705
1705
1706
1706
class TestHashTable :
1707
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False )
1708
1707
@pytest .mark .parametrize (
1709
1708
"htable, data" ,
1710
1709
[
1711
- (ht .PyObjectHashTable , [f"foo_{ i } " for i in range (1000 )]),
1712
- (ht .StringHashTable , [f"foo_{ i } " for i in range (1000 )]),
1710
+ (
1711
+ ht .PyObjectHashTable ,
1712
+ np .array ([f"foo_{ i } " for i in range (1000 )], dtype = object ),
1713
+ ),
1714
+ (
1715
+ ht .StringHashTable ,
1716
+ np .array ([f"foo_{ i } " for i in range (1000 )], dtype = object ),
1717
+ ),
1713
1718
(ht .Float64HashTable , np .arange (1000 , dtype = np .float64 )),
1714
1719
(ht .Int64HashTable , np .arange (1000 , dtype = np .int64 )),
1715
1720
(ht .UInt64HashTable , np .arange (1000 , dtype = np .uint64 )),
1716
1721
],
1717
1722
)
1718
1723
def test_hashtable_unique (self , htable , data , writable ):
1719
1724
# output of maker has guaranteed unique elements
1720
- s = Series (data )
1725
+ s = Series (data , dtype = data . dtype )
1721
1726
if htable == ht .Float64HashTable :
1722
1727
# add NaN for float column
1723
1728
s .loc [500 ] = np .nan
@@ -1744,20 +1749,25 @@ def test_hashtable_unique(self, htable, data, writable):
1744
1749
reconstr = result_unique [result_inverse ]
1745
1750
tm .assert_numpy_array_equal (reconstr , s_duplicated .values )
1746
1751
1747
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False )
1748
1752
@pytest .mark .parametrize (
1749
1753
"htable, data" ,
1750
1754
[
1751
- (ht .PyObjectHashTable , [f"foo_{ i } " for i in range (1000 )]),
1752
- (ht .StringHashTable , [f"foo_{ i } " for i in range (1000 )]),
1755
+ (
1756
+ ht .PyObjectHashTable ,
1757
+ np .array ([f"foo_{ i } " for i in range (1000 )], dtype = object ),
1758
+ ),
1759
+ (
1760
+ ht .StringHashTable ,
1761
+ np .array ([f"foo_{ i } " for i in range (1000 )], dtype = object ),
1762
+ ),
1753
1763
(ht .Float64HashTable , np .arange (1000 , dtype = np .float64 )),
1754
1764
(ht .Int64HashTable , np .arange (1000 , dtype = np .int64 )),
1755
1765
(ht .UInt64HashTable , np .arange (1000 , dtype = np .uint64 )),
1756
1766
],
1757
1767
)
1758
1768
def test_hashtable_factorize (self , htable , writable , data ):
1759
1769
# output of maker has guaranteed unique elements
1760
- s = Series (data )
1770
+ s = Series (data , dtype = data . dtype )
1761
1771
if htable == ht .Float64HashTable :
1762
1772
# add NaN for float column
1763
1773
s .loc [500 ] = np .nan
0 commit comments