summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2019-05-14 12:24:03 -0700
committerSebastian Berg <sebastian@sipsolutions.net>2019-05-21 23:17:56 -0700
commit9cdd0cb1967891c650fa5964b2cd683bbbb81f8a (patch)
tree15b162dd276c727392584b4447af8141299b7003
parent8970dc8e588776bbae45953b2809883c4b6f8ed0 (diff)
downloadnumpy-9cdd0cb1967891c650fa5964b2cd683bbbb81f8a.tar.gz
MAINT: Fix errors seen on new python 3.8
One of this is a small issue exposed by new warnings, the others are simply adapting our test suit to stricter integer coercion rules (avoiding float -> int conversions). The last one is that we assumed pickle protocol 5 would be in 3.8. It is not yet included in the alpha releases at least. It seems not necessary for the numpy test suit to check whether it is available based on the python version so removing that test. (Also testing if the pickle5 module works seems unnecessary.) Closes gh-13412
-rw-r--r--numpy/core/tests/test_multiarray.py11
-rw-r--r--numpy/random/tests/test_random.py6
-rw-r--r--numpy/tests/test_warnings.py2
3 files changed, 5 insertions, 14 deletions
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
index d22f16099..27ac96703 100644
--- a/numpy/core/tests/test_multiarray.py
+++ b/numpy/core/tests/test_multiarray.py
@@ -3702,17 +3702,6 @@ class TestSubscripting(object):
class TestPickling(object):
- def test_highest_available_pickle_protocol(self):
- try:
- import pickle5
- except ImportError:
- pickle5 = None
-
- if sys.version_info[:2] >= (3, 8) or pickle5 is not None:
- assert pickle.HIGHEST_PROTOCOL >= 5
- else:
- assert pickle.HIGHEST_PROTOCOL < 5
-
@pytest.mark.skipif(pickle.HIGHEST_PROTOCOL >= 5,
reason=('this tests the error messages when trying to'
'protocol 5 although it is not available'))
diff --git a/numpy/random/tests/test_random.py b/numpy/random/tests/test_random.py
index 711270072..121c7dd8c 100644
--- a/numpy/random/tests/test_random.py
+++ b/numpy/random/tests/test_random.py
@@ -515,7 +515,7 @@ class TestRandomDist(object):
def test_binomial(self):
np.random.seed(self.seed)
- actual = np.random.binomial(100.123, .456, size=(3, 2))
+ actual = np.random.binomial(100, .456, size=(3, 2))
desired = np.array([[37, 43],
[42, 48],
[46, 45]])
@@ -612,7 +612,7 @@ class TestRandomDist(object):
def test_hypergeometric(self):
np.random.seed(self.seed)
- actual = np.random.hypergeometric(10.1, 5.5, 14, size=(3, 2))
+ actual = np.random.hypergeometric(10, 5, 14, size=(3, 2))
desired = np.array([[10, 10],
[10, 10],
[9, 9]])
@@ -923,6 +923,8 @@ class TestRandomDist(object):
def __int__(self):
raise TypeError
+ __index__ = __int__
+
throwing_int = np.array(1).view(ThrowingInteger)
assert_raises(TypeError, np.random.hypergeometric, throwing_int, 1, 1)
diff --git a/numpy/tests/test_warnings.py b/numpy/tests/test_warnings.py
index aa6f69f7e..f5560a099 100644
--- a/numpy/tests/test_warnings.py
+++ b/numpy/tests/test_warnings.py
@@ -44,7 +44,7 @@ if sys.version_info >= (3, 4):
if p.ls[-1] == 'warn' and (
len(p.ls) == 1 or p.ls[-2] == 'warnings'):
- if "testing/tests/test_warnings.py" is self.__filename:
+ if "testing/tests/test_warnings.py" == self.__filename:
# This file
return