Skip to content

Commit

Permalink
Add tests for #312, #313
Browse files Browse the repository at this point in the history
  • Loading branch information
robbmcleod committed Aug 15, 2018
1 parent 4f4bb49 commit f0ab31f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions numexpr/tests/test_numexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@
long = int

# Recommended minimum versions
from distutils.version import StrictVersion
minimum_numpy_version = StrictVersion('1.7.0')
from distutils.version import LooseVersion
minimum_numpy_version = LooseVersion('1.7.0')

issue313 = "test that local_dict.clear() does not delete globals"

class test_numexpr(TestCase):
"""Testing with 1 thread"""
Expand Down Expand Up @@ -308,13 +309,20 @@ def test_where_scalar_bool(self):
res = evaluate('where(a, b, c)')
assert_array_equal(res, c)

# Regression test for issue #310

def test_refcount(self):
# Regression test for issue #310

global issue313

a = array([1])
assert sys.getrefcount(a) == 2
evaluate('1')
assert sys.getrefcount(a) == 2

# Regression test for #313, ensure that globals is never `.clear`'d
issue313 += '.'


class test_numexpr2(test_numexpr):
"""Testing with 2 threads"""
Expand Down Expand Up @@ -1017,7 +1025,7 @@ def print_versions():
from numexpr.cpuinfo import cpu
import platform

np_version = StrictVersion(np.__version__)
np_version = LooseVersion(np.__version__)

if minimum_numpy_version < np_version:
print('*Warning*: NumPy version is lower than recommended: %s < %s' % (np_version, minimum_numpy_version))
Expand Down

0 comments on commit f0ab31f

Please sign in to comment.