[SciPy-user] unittests for scipy.stats: assert_almost_equal question

Louis Luangkesorn lluang at yahoo.com
Sun Jan 20 02:08:16 EST 2002


Hi

I'm writting unittests for the scipy.stats framework (partly to
teach myself unit testing, partly to teach myself the stats
functions).  I'm writing them using Wilkinson's Statistic Quiz
(ref. in code attached) for data and comparison numbers.

Right now, I get 2 failures and 2 errors (using Numeric arrays).  I
think the complete framework needs another set of tests for the
same data in lists form (if I understand the scipy.stats module
correctly)

Of the failures/errors, some of them may be in the code, but one of
them maybe something I'm missing in the unit testing framework. 
For one of the tests, I get the following error:

======================================================================
FAIL: check_stdHUGE (__main__.test_basicstats)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Documents and Settings\kll560\My
Documents\testdata\test_stats.py", line 150, in check_stdHUGE
    assert_almost_equal(y,2.738612788e+12)
  File "C:\apps\Python\scipy\scipy_test.py", line 223, in
assert_almost_equal
    assert desired == actual, msg
AssertionError: 
Items are not equal:
DESIRED: 2.738612788e+012
ACTUAL: 2.73861278753e+012
----------------------------------------------------------------------

The assert_almost_equal function is being called using the default
setting of decimal=7   Since here it seems I have 10 digits of
accuracy, why did this fail?

Louis

PS  I'm attaching my code.  I followed the pattern from
test_misc.py



=====
When I consider your heavens, the work of your fingers,
the moon and the stars, which you have set in place,
what is man that you are mindful of him, the son of man that you care for him?    Psalm 8:3-4
Y!M, AOL, jabber.com: lluang

__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test_stats.py
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20020119/dc31a0c7/attachment.ksh>


More information about the SciPy-User mailing list