diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2015-10-11 17:40:04 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2015-10-11 17:40:04 -0600 |
commit | 9cc55dc7720a949cb3e6578805fe6f70906a700e (patch) | |
tree | fcc1227363ff2666c8491f1f00dbbd6950396293 /numpy/core | |
parent | 2b7eefbe0b146e5d4d0be991eb197c2fc8489893 (diff) | |
parent | 7978f3d422e24d1f92d626d19763e5b87193824e (diff) | |
download | numpy-9cc55dc7720a949cb3e6578805fe6f70906a700e.tar.gz |
Merge pull request #6449 from anntzer/fill-explicit-dtype-futurewarning
DEP: Remove warning for `full` when dtype is set.
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/numeric.py | 6 | ||||
-rw-r--r-- | numpy/core/tests/test_deprecations.py | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 5d4464ea7..5c0e27239 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -291,10 +291,10 @@ def full(shape, fill_value, dtype=None, order='C'): """ a = empty(shape, dtype, order) - if array(fill_value).dtype != a.dtype: + if dtype is None and array(fill_value).dtype != a.dtype: warnings.warn( - "in the future, full(..., {0!r}) will return an array of {1!r}". - format(fill_value, array(fill_value).dtype), FutureWarning) + "in the future, full({0}, {1!r}) will return an array of {2!r}". + format(shape, fill_value, array(fill_value).dtype), FutureWarning) multiarray.copyto(a, fill_value, casting='unsafe') return a diff --git a/numpy/core/tests/test_deprecations.py b/numpy/core/tests/test_deprecations.py index e3aea7efb..e2542195f 100644 --- a/numpy/core/tests/test_deprecations.py +++ b/numpy/core/tests/test_deprecations.py @@ -10,8 +10,9 @@ import operator import warnings import numpy as np -from numpy.testing import (run_module_suite, assert_raises, - assert_warns, assert_array_equal, assert_) +from numpy.testing import ( + run_module_suite, assert_raises, assert_warns, assert_no_warnings, + assert_array_equal, assert_) class _DeprecationTestCase(object): @@ -382,6 +383,7 @@ class TestFullDefaultDtype: def test_full_default_dtype(self): assert_warns(FutureWarning, np.full, 1, 1) assert_warns(FutureWarning, np.full, 1, None) + assert_no_warnings(np.full, 1, 1, float) if __name__ == "__main__": |