summaryrefslogtreecommitdiff
path: root/numpy/testing/utils.py
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2009-09-16 07:15:21 +0000
committerDavid Cournapeau <cournape@gmail.com>2009-09-16 07:15:21 +0000
commit364f7b87708a0f31b4bf09a510e0f325615b6b3f (patch)
tree434495b4a728caf9e94ee9b5f6f055956094b31d /numpy/testing/utils.py
parent064d50496ce946cb54e0901ac10967d9e0126b20 (diff)
downloadnumpy-364f7b87708a0f31b4bf09a510e0f325615b6b3f.tar.gz
All non core regressions tests moved to their respective modules.
Diffstat (limited to 'numpy/testing/utils.py')
-rw-r--r--numpy/testing/utils.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py
index df4596670..f08796dc2 100644
--- a/numpy/testing/utils.py
+++ b/numpy/testing/utils.py
@@ -14,7 +14,7 @@ __all__ = ['assert_equal', 'assert_almost_equal','assert_approx_equal',
'assert_array_almost_equal', 'assert_raises', 'build_err_msg',
'decorate_methods', 'jiffies', 'memusage', 'print_assert_equal',
'raises', 'rand', 'rundocs', 'runstring', 'verbose', 'measure',
- 'assert_']
+ 'assert_', 'assert_valid_refcount']
verbose = 0
@@ -947,3 +947,18 @@ def measure(code_str,times=1,label=None):
exec code in globs,locs
elapsed = jiffies() - elapsed
return 0.01*elapsed
+
+def assert_valid_refcount(op):
+ import numpy as np
+ a = np.arange(100 * 100)
+ b = np.arange(100*100).reshape(100, 100)
+ c = b
+
+ i = 1
+
+ rc = sys.getrefcount(i)
+ for j in range(15):
+ d = op(b,c)
+
+ assert(sys.getrefcount(i) >= rc)
+