[SciPy-user] unittests for scipy.stats:
Louis Luangkesorn
lluang at yahoo.com
Tue Jan 22 10:13:35 EST 2002
Eric,
I sent an email to Jim Weirich, who is the maintainer of
EiffleUnit. EiffleUnit has an assert_approximate function. His
reply is below. My feeling regarding the scipy_test.py is that I
rewrite the assert_approx_equals to match the behavior of the
EiffelUnit assert_approximate, since it does the same thing that I
want, and that we name the scipy function
assert_approximate_equals, in the interests of consistancy with
other XUnit type modules.
Oh, I'm going to have an update on assert_approx_equals regardless.
There are a couple of rather embarassing cases I don't account
for.
Louis
----forwarded message----
Hello Louis.
The short form of the assert_approximate function is ...
assert_approximate (message: STRING; expected, actual,
tolerance: DOUBLE) is
-- Assert that two values are approximately equal
-- (within a `tolerance').
require
message_exists: message /= Void
end
Assert_approximate uses a tolerance value to specify the value for
approximate. This allows the user to choose what close-enough
means.
For example ...
assert_approximate("absolute", expected, actual, 0.00001);
assert_approximate("relative", expected, actual, 0.001 *
expected);
I believe that JUnit has a version of assertEquals that takes two
double arguments and a double tolerance. assert_approximate mimics
that behavior.
I hope this helps.
-- -- Jim Weirich jweirich at one.net http://w3.one.net/~jweirich
> From: "eric" <eric at scipy.org>
> To: <scipy-user at scipy.org>
> Subject: Re: [SciPy-user] unittests for scipy.stats:
> assert_almost_equal question
> Date: Sun, 20 Jan 2002 22:38:03 -0500
> Organization: enthought
> Reply-To: scipy-user at scipy.net
>
> Hey Louis,
>
>
> Thanks. In my cursory checks, it looks to me like you've counted
> digits correctly. I'll add this to scipy_test. Does anyone have
> better names for
> these. They are quite arbitrary and indistinguishable right now.
> How about:
>
> assert_significant_equal
> assert_decimal_equal
>
> These names give a little more info about what is happening in
> the function.
>
> thoughts?
>
> eric
>
>
>
>
> --__--__--
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
>
>
> End of SciPy-user Digest
=====
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/
More information about the SciPy-User
mailing list