diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2012-01-02 19:45:18 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2012-01-09 11:09:37 -0700 |
commit | 77b8a2608168235fbb96543ddaac0d7b4ef663ff (patch) | |
tree | 0de75d5cc56865709fd5d940f5b49f1ca825789f /numpy/polynomial/tests/test_classes.py | |
parent | cb19ab65dfa741b043892310c1aab18f3d8d7691 (diff) | |
download | numpy-77b8a2608168235fbb96543ddaac0d7b4ef663ff.tar.gz |
ENH: Modify test classes to produce more informative test messages.
The tests were all generator based and that produced the same message
for all the tests when they were run in verbose mode. The quick fix
was to use the generator to write named test functions for all the tests.
Diffstat (limited to 'numpy/polynomial/tests/test_classes.py')
-rw-r--r-- | numpy/polynomial/tests/test_classes.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/numpy/polynomial/tests/test_classes.py b/numpy/polynomial/tests/test_classes.py index 373379435..c01342203 100644 --- a/numpy/polynomial/tests/test_classes.py +++ b/numpy/polynomial/tests/test_classes.py @@ -20,7 +20,7 @@ classes = ( Hermite, HermiteE) -def test_class_methods(): +def check_class_methods(): """Test all class methods""" for Poly1 in classes: for Poly2 in classes: @@ -52,6 +52,8 @@ def test_class_methods(): yield check_truncate, Poly yield check_trim, Poly + + # # helper functions # @@ -516,5 +518,21 @@ def check_mapparms(Poly) : p = Poly([1], domain=d, window=w) assert_almost_equal([1, 2], p.mapparms()) +for test in check_class_methods(): + if len(test) == 3: + f, a, b = [t.__name__ for t in test] + prefix = "def %s_%s_%s(): " % (f, a, b) + prefix = prefix.replace('check', 'test') + suffix = "%s(%s, %s)" % (f, a, b) + exec prefix + suffix + if len(test) == 2: + f, a = [t.__name__ for t in test] + prefix = "def %s_%s(): " % (f, a) + prefix = prefix.replace('check', 'test') + suffix = "%s(%s)" % (f, a) + exec prefix + suffix + + + if __name__ == "__main__": run_module_suite() |