diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2016-09-02 10:06:54 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-02 10:06:54 -0500 |
commit | 3dbbfd8db5c21c603620bebc98e03bc84334f11c (patch) | |
tree | e29eb26cfbf72ee9b03aa15dd02671bf17e70301 /numpy/core/_methods.py | |
parent | 9164f23c19c049e28d4d4825a53bbb01aedabcfc (diff) | |
parent | 68ea0c792db6bac435752e45d8681f7f1283453d (diff) | |
download | numpy-3dbbfd8db5c21c603620bebc98e03bc84334f11c.tar.gz |
Merge pull request #7148 from seberg/stacklevel+tests
ENH,TST: Bump stacklevel and add tests for warnings
Diffstat (limited to 'numpy/core/_methods.py')
-rw-r--r-- | numpy/core/_methods.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/numpy/core/_methods.py b/numpy/core/_methods.py index 5fc2bc445..54e267541 100644 --- a/numpy/core/_methods.py +++ b/numpy/core/_methods.py @@ -56,7 +56,7 @@ def _mean(a, axis=None, dtype=None, out=None, keepdims=False): rcount = _count_reduce_items(arr, axis) # Make this warning show up first if rcount == 0: - warnings.warn("Mean of empty slice.", RuntimeWarning) + warnings.warn("Mean of empty slice.", RuntimeWarning, stacklevel=2) # Cast bool, unsigned int, and int to float64 by default if dtype is None and issubclass(arr.dtype.type, (nt.integer, nt.bool_)): @@ -79,7 +79,8 @@ def _var(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False): rcount = _count_reduce_items(arr, axis) # Make this warning show up on top. if ddof >= rcount: - warnings.warn("Degrees of freedom <= 0 for slice", RuntimeWarning) + warnings.warn("Degrees of freedom <= 0 for slice", RuntimeWarning, + stacklevel=2) # Cast bool, unsigned int, and int to float64 by default if dtype is None and issubclass(arr.dtype.type, (nt.integer, nt.bool_)): |