summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2012-03-31 10:36:38 -0600
committerCharles Harris <charlesr.harris@gmail.com>2012-03-31 10:36:38 -0600
commit72185d34170369ec07e8e84ed18d2f6a814e327a (patch)
treed54fc6c0a5503d87e8058e8f24e1b6ae513dc8db
parent7c5d239d24c9a0b76f66dd273bf53278a3138264 (diff)
downloadnumpy-72185d34170369ec07e8e84ed18d2f6a814e327a.tar.gz
STY: Style fixes to numpy/core/tests/test_regression.
Make imports from numpy.testing explicit. Make test_unique_stable check against specific results.
-rw-r--r--numpy/core/tests/test_regression.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py
index 090498a63..f5ac0ceab 100644
--- a/numpy/core/tests/test_regression.py
+++ b/numpy/core/tests/test_regression.py
@@ -1,16 +1,20 @@
-from StringIO import StringIO
import pickle
import sys
import platform
import gc
import copy
-from os import path
-from numpy.testing import *
-from numpy.testing.utils import _assert_valid_refcount, WarningManager
-from numpy.compat import asbytes, asunicode, asbytes_nested
import warnings
import tempfile
+from StringIO import StringIO
+from os import path
import numpy as np
+from numpy.testing import (
+ run_module_suite, TestCase, assert_, assert_equal,
+ assert_almost_equal, assert_array_equal, assert_array_almost_equal,
+ assert_raises, assert_warns, dec
+ )
+from numpy.testing.utils import _assert_valid_refcount, WarningManager
+from numpy.compat import asbytes, asunicode, asbytes_nested
if sys.version_info[0] >= 3:
import io
@@ -1676,11 +1680,10 @@ class TestRegression(TestCase):
def test_unique_stable(self):
# Ticket #2063 must always choose stable sort for argsort to
# get consistent results
- v=np.array([0,0,0,0,0,1,1,1,1,1,1,2,2,2,2,2,2]*4)
- w=np.array([0,0,0,0,0,1,1,1,1,1,1,2,2,2,2])
- resv = np.unique(v,return_index=True)
- resw = np.unique(w,return_index=True)
- assert_equal(resv, resw)
+ v = np.array(([0]*5 + [1]*6 + [2]*6)*4)
+ res = np.unique(v, return_index=True)
+ tgt = (np.array([0, 1, 2]), np.array([ 0, 5, 11]))
+ assert_equal(res, tgt)
if __name__ == "__main__":
run_module_suite()