From e5eb3fa062516398895cef2a16558bbaef6d00d8 Mon Sep 17 00:00:00 2001 From: Jeff Whitaker Date: Sun, 20 Jun 2021 15:59:19 -0600 Subject: [PATCH] fix test so it doesn't fail on 32 bit machines --- test/tst_slicing.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/tst_slicing.py b/test/tst_slicing.py index 7d56f54c6..1b5c0bde2 100644 --- a/test/tst_slicing.py +++ b/test/tst_slicing.py @@ -2,7 +2,7 @@ from numpy.random import seed, randint from numpy.testing import assert_array_equal, assert_equal,\ assert_array_almost_equal -import tempfile, unittest, os, random +import tempfile, unittest, os, random, sys import numpy as np file_name = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name @@ -35,8 +35,8 @@ def setUp(self): vu[:,::-1,:] = data v1[:] = data[:, 0, 0] - #v2[0:2**31] = 1 # issue 1112 (overflow on windows) - v2[2**31] = 1 # issue 1112 (overflow on windows) + if sys.maxsize > 2**32: + v2[2**31] = 1 # issue 1112 (overflow on windows) f.close() def tearDown(self): @@ -82,8 +82,8 @@ def test_1d(self): v2 = f.variables['data1dx'] d = data[:,0,0] assert_equal(v1[:], d) - #assert_equal(v2[:], np.ones(2**31,dtype=np.uint8)) - assert_equal(v2[2**31], 1) + if sys.maxsize > 2**32: + assert_equal(v2[2**31], 1) assert_equal(v1[4:], d[4:]) # test return of array scalar. assert_equal(v1[0].shape, ())