Commit 8ce8325
Enable mypy type checking for 5 test files (#10763)
* Enable mypy type checking for 8 test files
Remove 8 test files from mypy exclusion list and fix all type errors:
- test_duck_array_ops.py
- test_indexing.py
- test_sparse.py
- test_units.py
- test_variable.py
- test_merge.py
- test_ufuncs.py
- test_weighted.py
Changes include:
- Added type annotations for function return types and variables
- Fixed variable name conflicts to avoid shadowing
- Added minimal type ignores only where necessary (third-party limitations)
- Changed .get(key) to [key] for better Python idioms
- Fixed scipy_.py import fallback type issue
All tests pass with zero mypy errors.
Co-authored-by: Claude <[email protected]>
* Fix mypy unused-ignore order: assignment before misc
The CI requires 'assignment, misc' order for the type ignore comment.
Co-authored-by: Claude <[email protected]>
* Revert to original type ignore order [misc, assignment]
The CI environment may have different mypy configuration. Using the original order.
Co-authored-by: Claude <[email protected]>
* Remove type ignore from scipy_.py ImportError fallback
The CI has scipy-stubs installed which provides proper typing for scipy.io.netcdf_file,
so the type ignore is unnecessary and causes an 'unused-ignore' error.
Co-authored-by: Claude <[email protected]>
---------
Co-authored-by: Claude <[email protected]>1 parent 7228e8f commit 8ce8325
File tree
6 files changed
+171
-161
lines changed- xarray/tests
6 files changed
+171
-161
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | 193 | | |
199 | 194 | | |
200 | 195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
67 | | - | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
73 | | - | |
| 74 | + | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| |||
940 | 941 | | |
941 | 942 | | |
942 | 943 | | |
943 | | - | |
944 | | - | |
| 944 | + | |
| 945 | + | |
945 | 946 | | |
946 | 947 | | |
947 | 948 | | |
| |||
951 | 952 | | |
952 | 953 | | |
953 | 954 | | |
954 | | - | |
955 | | - | |
| 955 | + | |
| 956 | + | |
956 | 957 | | |
957 | 958 | | |
958 | 959 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
642 | 642 | | |
643 | 643 | | |
644 | 644 | | |
645 | | - | |
| 645 | + | |
646 | 646 | | |
647 | 647 | | |
648 | 648 | | |
| |||
676 | 676 | | |
677 | 677 | | |
678 | 678 | | |
679 | | - | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
680 | 682 | | |
681 | 683 | | |
682 | | - | |
683 | | - | |
| 684 | + | |
| 685 | + | |
684 | 686 | | |
685 | 687 | | |
686 | | - | |
687 | | - | |
| 688 | + | |
| 689 | + | |
688 | 690 | | |
689 | 691 | | |
690 | | - | |
691 | | - | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
692 | 698 | | |
693 | 699 | | |
694 | | - | |
695 | | - | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
696 | 706 | | |
697 | 707 | | |
698 | | - | |
699 | | - | |
700 | | - | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
701 | 711 | | |
702 | 712 | | |
703 | | - | |
704 | | - | |
705 | | - | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
706 | 716 | | |
707 | 717 | | |
708 | 718 | | |
709 | 719 | | |
710 | 720 | | |
711 | | - | |
712 | | - | |
| 721 | + | |
| 722 | + | |
713 | 723 | | |
714 | 724 | | |
715 | | - | |
716 | | - | |
717 | | - | |
718 | | - | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
719 | 731 | | |
720 | 732 | | |
721 | 733 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
661 | 661 | | |
662 | 662 | | |
663 | 663 | | |
664 | | - | |
| 664 | + | |
665 | 665 | | |
666 | | - | |
| 666 | + | |
| 667 | + | |
667 | 668 | | |
668 | 669 | | |
669 | 670 | | |
670 | 671 | | |
671 | 672 | | |
672 | 673 | | |
673 | | - | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
674 | 677 | | |
675 | 678 | | |
676 | 679 | | |
| |||
753 | 756 | | |
754 | 757 | | |
755 | 758 | | |
756 | | - | |
757 | | - | |
| 759 | + | |
| 760 | + | |
758 | 761 | | |
759 | 762 | | |
760 | 763 | | |
| |||
781 | 784 | | |
782 | 785 | | |
783 | 786 | | |
784 | | - | |
| 787 | + | |
785 | 788 | | |
786 | 789 | | |
787 | 790 | | |
| |||
835 | 838 | | |
836 | 839 | | |
837 | 840 | | |
838 | | - | |
839 | | - | |
| 841 | + | |
| 842 | + | |
840 | 843 | | |
841 | 844 | | |
842 | 845 | | |
| |||
852 | 855 | | |
853 | 856 | | |
854 | 857 | | |
855 | | - | |
856 | | - | |
| 858 | + | |
| 859 | + | |
857 | 860 | | |
858 | 861 | | |
859 | | - | |
860 | | - | |
| 862 | + | |
| 863 | + | |
861 | 864 | | |
862 | 865 | | |
863 | 866 | | |
| |||
0 commit comments