Skip to content

CI: check for numpy.random-related imports #37117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
5 changes: 5 additions & 0 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
invgrep -r -E --include '*.py' --exclude testing.py '(numpy|np)(\.testing|\.array_equal)' pandas/tests/
RET=$(($RET + $?)) ; echo $MSG "DONE"

# GH37053, Check for np.random.<method> instead of `from numpy.random import` or `from numpy import random`
MSG='Check for numpy.random-related imports' ; echo $MSG
invgrep -R --include="*.py" --exclude=_testing.py -E "(from numpy.random import)|(from numpy import random)" pandas
RET=$(($RET + $?)) ; echo $MSG "DONE"

# Check for the following code in the extension array base tests: `tm.assert_frame_equal` and `tm.assert_series_equal`
MSG='Check for invalid EA testing' ; echo $MSG
invgrep -r -E --include '*.py' --exclude base.py 'tm.assert_(series|frame)_equal' pandas/tests/extension/base
Expand Down