Permalink
Browse files

REF Begin refactoring unit tests.

Use nose tests instead of unittest. And test with
a lot more ndim, shapes, dtypes by using a function
that generates input data instead of hard coding.

So far the new tests have discovered some failures.
For example, larry.cumsum() and cumprod() return
int16 with int16 input. Should return default int
for platform. Failures where not yet fixed.
  • Loading branch information...
1 parent e6c7041 commit f768fddf4ece92e37a7a59dd8e262f86a84da34e @kwgoodman committed Apr 28, 2012
Showing with 161 additions and 492 deletions.
  1. +1 −0 .gitignore
  2. +2 −2 README.rst
  3. +0 −26 la/tests/deflarry_nose_test.py
  4. +12 −464 la/tests/deflarry_test.py
  5. +146 −0 la/tests/deflarry_unary_test.py
View
@@ -1,3 +1,4 @@
+.coverage
*.pyc
build
dist
View
@@ -122,9 +122,9 @@ After you have installed ``la``, run the suite of unit tests::
>>> import la
>>> la.test()
<snip>
- Ran 3064 tests in 1.408s
+ Ran 2995 tests in 11.011s
OK
- <nose.result.TextTestResult run=3064 errors=0 failures=0>
+ <nose.result.TextTestResult run=2995 errors=0 failures=0>
The ``la`` package contains C extensions that speed up common alignment
operations such as adding two unaligned larrys. If the C extensions don't
@@ -80,18 +80,6 @@ def assert_larry(opname, la, t, lab, msgstr):
las = [(la1,'la1'), (la2,'la2'), (la1_3d, 'la1_3d'), (la3,'la3')]
lasnonan = [(la1,'la1'), (la1_3d, 'la1_3d')]
-
-def test_methods_unary():
- "larry unary nose test"
- # Simple unary elementwise operations
- for la, laname in las:
- for opname in meth_unary1:
- npop = getattr(np,opname)
- t = npop(la.x) # Add +1 here to check whether tests fail
- p = getattr(la, opname)()
-
- yield assert_larry, opname, p, t, la.label, laname
- yield assert_, noreference(p, la), opname + ' - noreference'
def test_methods_reduce():
"larry reduce nose test"
@@ -113,20 +101,6 @@ def test_methods_reduce():
yield assert_larry, opname, p, t, tlab, \
laname+' axis='+str(axis)
-def test_methods_nonan():
- "larry nonan nose test"
- # Simple unary elementwise operations
- for la, laname in lasnonan:
- for opname in meth_nonan:
- npop = getattr(np,opname)
-
- for axis in range(la.x.ndim):
- t = npop(la.x, axis)
- p = getattr(la, opname)(axis)
- tlab = deepcopy(la.label)
- yield assert_larry, opname, p, t, tlab, \
- laname+' axis='+str(axis)
-
class est_calc(object):
"Test calc functions of larry class"
Oops, something went wrong.

0 comments on commit f768fdd

Please sign in to comment.