Commit b27eebd
TYP: Add variance checks to aggregation tests and type assertions (#1546)
* Add variance checks to aggregation tests and type assertions
- Updated aggregation tests in `test_agg.py` to include checks for the `var()` method across different data types (float, bool, int, and complex).
- Added a warning check for complex series when calculating variance to handle potential loss of imaginary parts.
- Enhanced type assertions in `test_series.py` for the `var()` method to ensure it returns a float type.
* Undo the tests/_typing.py change
* TYP: Fix Series.var() return type annotations:
- Fix `Series[complex].var()` return type from `np.float64` to `float`
- Add `Series[Timedelta].var()` overload returning `Never` (invalid operation)
- Add upper bound `upper="2.3.99"` for complex variance warning test
- Add Timedelta var() invalid usage test
* GH1546 PR Feedback
* Update tests/series/test_agg.py
Co-authored-by: Yi-Fan Wang <[email protected]>
* Fix type checking for series variance function
---------
Co-authored-by: Loïc Diridollou <[email protected]>
Co-authored-by: Yi-Fan Wang <[email protected]>1 parent 694b1a6 commit b27eebd
File tree
3 files changed
+58
-6
lines changed- pandas-stubs/core
- tests/series
3 files changed
+58
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4636 | 4636 | | |
4637 | 4637 | | |
4638 | 4638 | | |
| 4639 | + | |
4639 | 4640 | | |
4640 | | - | |
| 4641 | + | |
4641 | 4642 | | |
4642 | 4643 | | |
4643 | 4644 | | |
4644 | 4645 | | |
4645 | 4646 | | |
4646 | | - | |
| 4647 | + | |
| 4648 | + | |
| 4649 | + | |
| 4650 | + | |
| 4651 | + | |
| 4652 | + | |
| 4653 | + | |
| 4654 | + | |
| 4655 | + | |
| 4656 | + | |
| 4657 | + | |
| 4658 | + | |
| 4659 | + | |
| 4660 | + | |
| 4661 | + | |
| 4662 | + | |
| 4663 | + | |
| 4664 | + | |
| 4665 | + | |
| 4666 | + | |
| 4667 | + | |
| 4668 | + | |
| 4669 | + | |
| 4670 | + | |
| 4671 | + | |
| 4672 | + | |
| 4673 | + | |
| 4674 | + | |
4647 | 4675 | | |
4648 | 4676 | | |
4649 | 4677 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
| |||
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| 20 | + | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
| 28 | + | |
24 | 29 | | |
25 | 30 | | |
26 | 31 | | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
| 36 | + | |
31 | 37 | | |
32 | 38 | | |
33 | 39 | | |
34 | 40 | | |
35 | 41 | | |
36 | 42 | | |
37 | 43 | | |
| 44 | + | |
38 | 45 | | |
39 | 46 | | |
40 | 47 | | |
| |||
57 | 64 | | |
58 | 65 | | |
59 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
60 | 73 | | |
61 | 74 | | |
62 | 75 | | |
| |||
65 | 78 | | |
66 | 79 | | |
67 | 80 | | |
| 81 | + | |
68 | 82 | | |
69 | 83 | | |
70 | 84 | | |
| |||
75 | 89 | | |
76 | 90 | | |
77 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
78 | 97 | | |
79 | 98 | | |
80 | 99 | | |
| |||
83 | 102 | | |
84 | 103 | | |
85 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
780 | 780 | | |
781 | 781 | | |
782 | 782 | | |
783 | | - | |
784 | | - | |
785 | | - | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
786 | 786 | | |
787 | 787 | | |
788 | 788 | | |
| |||
0 commit comments