@@ -962,27 +962,21 @@ def test_value_counts_uint64(self):
962
962
if not compat .is_platform_32bit ():
963
963
tm .assert_series_equal (result , expected )
964
964
965
- def test_value_counts_nonsorted_single_occurance (self ):
965
+ @pytest .mark .parametrize ("sort" , [True , False ])
966
+ def test_value_counts_single_occurance (self , sort ):
966
967
# GH 12679
968
+ if sort == True :
969
+ pytest .xfail (reason = "sort=True does not guarantee the same order" )
970
+
967
971
# All items occour exactly once.
968
972
# No matter if sorted or not, the resulting values should be in
969
973
# the same order.
970
974
s = Series (list ('bacdef' ))
971
975
972
976
# Guarantee the same index if value_counts(sort=False) is used
973
- vc = s .value_counts (sort = False , ascending = False )
974
- tm .assert_series_equal (Series (vc .index ), s )
975
- vc = s .value_counts (sort = False , ascending = True )
976
- tm .assert_series_equal (Series (vc .index ), s )
977
-
978
- @pytest .mark .xfail (reason = "sort=True does not guarantee the same order" )
979
- def test_value_counts_sorted_single_occurance (self ):
980
- # GH 12679
981
- s = Series (list ('bacdef' ))
982
- # Guarantee does not hold yet for the sort=True case
983
- vc = s .value_counts (sort = True , ascending = False )
977
+ vc = s .value_counts (sort = sort , ascending = False )
984
978
tm .assert_series_equal (Series (vc .index ), s )
985
- vc = s .value_counts (sort = True , ascending = True )
979
+ vc = s .value_counts (sort = sort , ascending = True )
986
980
tm .assert_series_equal (Series (vc .index ), s )
987
981
988
982
def test_value_counts_nonsorted_double_occurance (self ):
0 commit comments