Commit 65849d3
TST: Clean up tests of DataFrame.sort_{index,values} (#13496)
* TST: Clean up tests of DataFrame.sort_{index,values}
* Factor out Series sorting tests to own file.
* Delegate deprecated sort() and order() to their own tests.
Before this commit, the `Series.sort_values()` tests relied on deprecated
`Series.sort()` and `Series.order()` as the source of truth. However
they both merely called `Series.sort_values()` under the hood.
This commit consolidates the core test logic against `.sort_values()`
directly, while `.sort()` and `.order()` merely check for equivalence
with `.sort_values()`.
Also removes some no-op assertions that had rotted from the old days of
`sort()`/`order()`.
* Remove 'by' docstring from Series.sort_values
* Document defaults for optional sorting args
* Move more sort_values, sort_index tests to be together.
* Add test for Series.sort_index(sort_remaining=True)
* Improve `sort_values` tests when multiple `by`s
Duplicates values in the test DataFrame are necessary
to fully test this feature.
* PEP8 cleanup
* Annotate tests with GH issue
* Fix indentation - docstring string replacement1 parent 2f7fdd0 commit 65849d3
File tree
6 files changed
+226
-215
lines changed- pandas
- core
- tests
- frame
- series
6 files changed
+226
-215
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
73 | 77 | | |
74 | 78 | | |
75 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| |||
1961 | 1964 | | |
1962 | 1965 | | |
1963 | 1966 | | |
1964 | | - | |
1965 | | - | |
1966 | | - | |
1967 | | - | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
1968 | 1970 | | |
1969 | 1971 | | |
1970 | 1972 | | |
1971 | | - | |
| 1973 | + | |
1972 | 1974 | | |
1973 | | - | |
| 1975 | + | |
1974 | 1976 | | |
1975 | 1977 | | |
1976 | 1978 | | |
1977 | 1979 | | |
1978 | | - | |
| 1980 | + | |
1979 | 1981 | | |
1980 | 1982 | | |
1981 | 1983 | | |
| |||
1997 | 1999 | | |
1998 | 2000 | | |
1999 | 2001 | | |
2000 | | - | |
| 2002 | + | |
2001 | 2003 | | |
2002 | | - | |
| 2004 | + | |
2003 | 2005 | | |
2004 | 2006 | | |
2005 | 2007 | | |
2006 | 2008 | | |
2007 | | - | |
| 2009 | + | |
2008 | 2010 | | |
2009 | | - | |
| 2011 | + | |
2010 | 2012 | | |
2011 | 2013 | | |
2012 | 2014 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
| 24 | + | |
| 25 | + | |
26 | 26 | | |
27 | | - | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 30 | + | |
37 | 31 | | |
38 | | - | |
39 | | - | |
40 | 32 | | |
| 33 | + | |
41 | 34 | | |
42 | 35 | | |
43 | | - | |
44 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
45 | 39 | | |
| 40 | + | |
| 41 | + | |
46 | 42 | | |
47 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
48 | 47 | | |
49 | 48 | | |
50 | | - | |
51 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| 60 | + | |
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
63 | | - | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
70 | | - | |
| 73 | + | |
71 | 74 | | |
72 | 75 | | |
73 | 76 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
89 | 82 | | |
90 | | - | |
91 | | - | |
92 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
93 | 86 | | |
94 | 87 | | |
95 | 88 | | |
| |||
109 | 102 | | |
110 | 103 | | |
111 | 104 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
116 | 108 | | |
117 | 109 | | |
118 | | - | |
119 | | - | |
| 110 | + | |
120 | 111 | | |
121 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
122 | 116 | | |
123 | 117 | | |
124 | 118 | | |
| |||
130 | 124 | | |
131 | 125 | | |
132 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
133 | 146 | | |
134 | 147 | | |
135 | 148 | | |
| |||
361 | 374 | | |
362 | 375 | | |
363 | 376 | | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | 377 | | |
384 | 378 | | |
385 | 379 | | |
| |||
0 commit comments