summaryrefslogtreecommitdiff
path: root/numpy/core/tests
diff options
context:
space:
mode:
authorSeth Troisi <sethtroisi@google.com>2020-01-23 16:49:01 -0800
committerSeth Troisi <sethtroisi@google.com>2020-01-23 16:52:25 -0800
commit823f6819dd86e75f772a3a725996773dd6b688e2 (patch)
tree85b754adb9f658fea27e9b7c4eeb383c16b1a1fd /numpy/core/tests
parent68224f43d09393c1981bb83ee3c13a5158d2817c (diff)
downloadnumpy-823f6819dd86e75f772a3a725996773dd6b688e2.tar.gz
MAINT: Remove Python2 workarounds
Diffstat (limited to 'numpy/core/tests')
-rw-r--r--numpy/core/tests/test_multiarray.py5
-rw-r--r--numpy/core/tests/test_scalarprint.py6
2 files changed, 4 insertions, 7 deletions
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
index 16f4f0b80..b0cfc24a8 100644
--- a/numpy/core/tests/test_multiarray.py
+++ b/numpy/core/tests/test_multiarray.py
@@ -6273,10 +6273,7 @@ def test_matmul_inplace():
assert_raises(TypeError, a.__imatmul__, b)
import operator
assert_raises(TypeError, operator.imatmul, a, b)
- # we avoid writing the token `exec` so as not to crash python 2's
- # parser
- exec_ = getattr(builtins, "exec")
- assert_raises(TypeError, exec_, "a @= b", globals(), locals())
+ assert_raises(TypeError, exec, "a @= b", globals(), locals())
def test_matmul_axes():
a = np.arange(3*4*5).reshape(3, 4, 5)
diff --git a/numpy/core/tests/test_scalarprint.py b/numpy/core/tests/test_scalarprint.py
index d042eef8b..126191856 100644
--- a/numpy/core/tests/test_scalarprint.py
+++ b/numpy/core/tests/test_scalarprint.py
@@ -30,12 +30,12 @@ class TestRealScalars:
def test_scalar_cutoffs(self):
# test that both the str and repr of np.float64 behaves
- # like python floats in python3. Note that in python2
- # the str has truncated digits, but we do not do this
+ # like python floats in python3.
def check(v):
- # we compare str to repr, to avoid python2 truncation behavior
+ assert_equal(str(np.float64(v)), str(v))
assert_equal(str(np.float64(v)), repr(v))
assert_equal(repr(np.float64(v)), repr(v))
+ assert_equal(repr(np.float64(v)), str(v))
# check we use the same number of significant digits
check(1.12345678901234567890)