[SciPy-Dev] adding test to test_random.py

Vincent Davis vincent@vincentdavis....
Mon Jun 14 07:34:03 CDT 2010


On Sun, Jun 13, 2010 at 8:27 PM, Robert Kern <robert.kern@gmail.com> wrote:
> On Sun, Jun 13, 2010 at 21:23, Vincent Davis <vincent@vincentdavis.net> wrote:
>> On Sunday, June 13, 2010, Robert Kern <robert.kern@gmail.com> wrote:
>>> On Sun, Jun 13, 2010 at 21:09, Vincent Davis <vincent@vincentdavis.net> wrote:
>>>> On Sunday, June 13, 2010, Robert Kern <robert.kern@gmail.com> wrote:
>>>>> On Sun, Jun 13, 2010 at 20:38, Vincent Davis <vincent@vincentdavis.net> wrote:
>>>>>> It seems I have screwed something up. It works for the 32bit version
>>>>>> but not the 64bit I have been modifying. (see below). I guess I need
>>>>>> to spend more time investigating this.
>>>>>
>>>>> Exactly what are you doing? What file are you modifying?
>>>>
>>>> Not at my computer now but I think
>>>> sitepackages/numpy/random/tests/test_random.py
>>>
>>> But the Python executable that you are running is the 32-bit version:
>>
>> I have both versions installed. I am modifying the 64 bit install and
>> that test does not work.
>
> Right. What you showed me was the result of your running the 32-bit
> Python executable. That will not show any modifications you made to
> your 64-bit install.

Ok got it working, I think I was chasing my tail. Actually do file
permissions matter, I had changed the permission on the file to allow
me to edit it without root permissions?

So the the randn(3,3) test fails as expected (see below). Now to add a
few more tests.
Thanks again
Vincent

Python 2.6.5 |EPD 6.2-1 (64-bit)| (r265:79063, May 28 2010, 15:24:16)
[GCC 4.0.1 (Apple Inc. build 5488)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.random.test(verbose=2)
Running unit tests for numpy.random
NumPy version 1.4.0
NumPy is installed in
/Library/Frameworks/EPD64.framework/Versions/6.2/lib/python2.6/site-packages/numpy
Python version 2.6.5 |EPD 6.2-1 (64-bit)| (r265:79063, May 28 2010,
15:24:16) [GCC 4.0.1 (Apple Inc. build 5488)]
nose version 0.11.3
test_basic (test_random.TestMultinomial) ... ok
test_int_negative_interval (test_random.TestMultinomial) ... ok
test_zero_probability (test_random.TestMultinomial) ... ok
test_rand (test_random.TestRandomDist) ... ok
test_randn (test_random.TestRandomDist) ... FAIL
Make sure generated random variables are in [-pi, pi]. ... ok
Test for ticket #921 ... ok
Test for ticket #923 ... ok
Make sure we can accept old state tuples that do not have the cached ... ok
test_basic (test_random.TestSetState) ... ok
Make sure the cached every-other-Gaussian is reset. ... ok
When the state is saved with a cached Gaussian, make sure the cached ... ok
Ensure that the negative binomial results take floating point ... ok

======================================================================
FAIL: test_randn (test_random.TestRandomDist)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Frameworks/EPD64.framework/Versions/6.2/lib/python2.6/site-packages/numpy/random/tests/test_random.py",
line 123, in test_randn
    np.testing.assert_array_equal(actual, desired)
  File "/Library/Frameworks/EPD64.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing/utils.py",
line 677, in assert_array_equal
    verbose=verbose, header='Arrays are not equal')
  File "/Library/Frameworks/EPD64.framework/Versions/6.2/lib/python2.6/site-packages/numpy/testing/utils.py",
line 609, in assert_array_compare
    raise AssertionError(msg)
AssertionError:
Arrays are not equal

(mismatch 100.0%)
 x: array([[ 0.2373197 , -1.35843925, -0.39112844],
       [-0.30154253,  1.83148329, -0.57565507],
       [ 0.13782929, -0.30625025,  0.33962918]])
 y: array([[ 1.34016346,  1.73759123,  1.49898834],
       [-0.22864333,  2.031034  ,  2.17032495],
       [ 1.59645265, -0.76945156,  0.56605824]])

----------------------------------------------------------------------
Ran 13 tests in 0.085s

FAILED (failures=1)
<nose.result.TextTestResult run=13 errors=0 failures=1>


>
> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless
> enigma that is made terrible by our own mad attempt to interpret it as
> though it had an underlying truth."
>  -- Umberto Eco
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>


More information about the SciPy-Dev mailing list