Unit test error with numpy rc3
Tim Hochberg
tim.hochberg at ieee.org
Thu Oct 19 12:03:10 EDT 2006
Travis Oliphant wrote:
> Tim Hochberg wrote:
>
>
>> Travis Oliphant wrote:
>>
>>
>>
>>> Tim Hochberg wrote:
>>>
>>>
>>>
>>>
>>>> Rudolph van der Merwe wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> I get the following error with RC3 on a RHE Linux box:
>>>>>
>>>>> Python 2.4.3 (#4, Mar 31 2006, 12:12:43)
>>>>> [GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
>>>>> Type "help", "copyright", "credits" or "license" for more information.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>>> import numpy
>>>>>>>> numpy.__version__
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>> '1.0rc3'
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>> On a visual studio build, I'm getting a real failure though:
>>>>
>>>> FAIL: Ticket #112
>>>> ----------------------------------------------------------------------
>>>> Traceback (most recent call last):
>>>> File
>>>> "C:\Python24\lib\site-packages\numpy\core\tests\test_regression.py",
>>>> line 219, in check_longfloat_repr
>>>> assert(str(a)[1:9] == str(a[0])[:8])
>>>> AssertionError
>>>>
>>>> The code in question is dependent on the spelling of INF(or at least the
>>>> *length* of the spelling) on a given platform which is why it's failing.
>>>>
>>>>
>>>>
>>>>
>>>>
>>> Actually, you shouldn't be getting an INF at all. This is what the
>>> test is designed to test for (so I guess it's working). The test was
>>> actually written wrong and was never failing because previously keyword
>>> arguments to ufuncs were ignored.
>>>
>>> Can you show us what 'a' is on your platform.
>>>
>>>
>>>
>> Sure:
>>
>>
>>>>> import numpy as N
>>>>> a = N.exp(N.array([1000],dtype=N.longfloat))
>>>>>
>> Warning: overflow encountered in exp
>>
>>>>> a
>>>>>
>> array([1.#INF], dtype=float64)
>>
>>
>>
> O.K. We need to modify the test in case to check and see that the size
> of longfloat isn't the same as double.
>
How about:
def check_longfloat_repr(self,level=rlevel):
"""Ticket #112"""
if N.dtype(N.longfloat) != N.dtype(N.float):
a = N.exp(N.array([1000],dtype=N.longfloat))
assert(str(a)[1:9] == str(a[0])[:8])
That seems to work here.
-tim
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
More information about the NumPy-Discussion
mailing list