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

Louis Luangkesorn lluang at yahoo.com
Sun Jan 20 01:08:16 CST 2002


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

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
  File "C:\apps\Python\scipy\scipy_test.py", line 223, in
    assert desired == actual, msg
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?


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

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!
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test_stats.py
Url: http://projects.scipy.org/pipermail/scipy-user/attachments/20020119/dc31a0c7/attachment.pl 

More information about the SciPy-user mailing list