Ticket #146 (closed defect: worksforme)

Opened 3 years ago

Last modified 3 years ago

Test-Suite fails with """AssertionError: '(a+1) ** 4'""" in test_numexpr.py

Reported by: latrine00@… Owned by: somebody
Priority: major Component: PyTables
Version: 2.0 Keywords: test-fail post-installation test_numexpr.py
Cc:

Description (last modified by ivilata) (diff)

After Installation of pytables 2.0.2 by running tables-2.0.2.win32-py2.5.exe I got 30 assertion exceptions while running the test-suite:

>>> import tables
>>> tables.test()

Kind of errors:
Traceback (most recent call last):
  File "C:\Python25\Lib\site-packages\tables\numexpr\tests\test_numexpr.py", line 261, in method
    npval, type(npval), neval, type(neval))
AssertionError: '(a+1)**1'
(test_scalar=2, dtype='long', optimization='aggressive', exact=False,
 npval=array([  1,   3,   5,   7,   9,  11,  12,  15,  17,  19,  20,  22,  24,
        27,  28,  30,  33,  35,  37,  39,  41,  43,  45,  47,  49,  51,
        53,  54,  57,  58,  60,  62,  64,  66,  68,  71,  72,  74,  77,
        79,  81,  82,  85,  86,  89,  91,  93,  95,  96,  99, 101, 103,
       105, 107, 108, 111, 112, 115, 117, 119, 120, 123, 124, 127, 129,
       131, 132, 135, 137, 139, 141, 142, 144, 147, 148, 151, 153, 154,
       157, 159, 161, 163, 164, 166, 168, 171, 173, 175, 176, 179, 181,
       182, 185, 187, 188, 190, 192, 194, 197, 199], dtype=int64) (<type 'numpy.ndarray'>), neval=array([  1,   3,   5,   7,   9,  11,  13,  15,  17,  19,  21,  23,  25,
        27,  29,  31,  33,  35,  37,  39,  41,  43,  45,  47,  49,  51,
        53,  55,  57,  59,  61,  63,  65,  67,  69,  71,  73,  75,  77,
        79,  81,  83,  85,  87,  89,  91,  93,  95,  97,  99, 101, 103,
       105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129,
       131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155,
       157, 159, 161, 163, 165, 167, 169, 171, 173, 175, 177, 179, 181,
       183, 185, 187, 189, 191, 193, 195, 197, 199], dtype=int64) (<type 'numpy.ndarray'>))

Attachments

test-trace.txt (70.0 kB) - added by latrine00@… 3 years ago.
Output of tables.test() with version info

Change History

Changed 3 years ago by latrine00@…

Output of tables.test() with version info

follow-up: ↓ 4   Changed 3 years ago by ivilata

Really curious... Could you please post the result of running the following simple, isolated test?

import numpy
from tables.numexpr import evaluate

a = numpy.arange(0, 200, 2, dtype='int64')
np = (a+1)**1
nx = evaluate('(a+1)**1')
equal = numpy.all(np == nx)
print equal
if not equal:
    print 'NumPy:', np
    print 'NExpr:', nx

follow-up: ↓ 3   Changed 3 years ago by latrine00@…

Here we are...

False NumPy?: [ 1 3 5 7 9 11 12 15 17 19 20 22 24 27 28 30 33 35

37 39 41 43 45 47 49 51 53 54 57 58 60 62 64 66 68 71 72 74 77 79 81 82 85 86 89 91 93 95 96 99 101 103 105 107

108 111 112 115 117 119 120 123 124 127 129 131 132 135 137 139 141 142 144 147 148 151 153 154 157 159 161 163 164 166 168 171 173 175 176 179 181 182 185 187 188 190 192 194 197 199]

NExpr: [ 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35

37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107

109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171 173 175 177 179 181 183 185 187 189 191 193 195 197 199]

in reply to: ↑ 2   Changed 3 years ago by latrine00@…

sorry, I didnt find the reply button...

in reply to: ↑ 1   Changed 3 years ago by anonymous

...

  Changed 3 years ago by ivilata

  • description modified (diff)

(Just placed original test output in a code block.)

follow-up: ↓ 7   Changed 3 years ago by ivilata

  • status changed from new to closed
  • resolution set to worksforme

Well, this looks like a NumPy bug in your platform, since running the previous code under Linux/i686 (same NumPy version) works as expected. You can run this:

import numpy
a = numpy.arange(0, 200, 2, dtype='int64')
np = (a+1)**1
print a
print np

If there is an even number in the second array, then NumPy is obviously wrong (please note that PyTables has nothing to do in this code). You can report NumPy bugs at http://projects.scipy.org/scipy/numpy

(If the error only shows up when using PyTables, please reopen the ticket. Thanks.)

in reply to: ↑ 6   Changed 3 years ago by latrine00@…

This is the output from your test-code:

array([  0,   2,   4,   6,   8,  10,  12,  14,  16,  18,  20,  22,  24,
        26,  28,  30,  32,  34,  36,  38,  40,  42,  44,  46,  48,  50,
        52,  54,  56,  58,  60,  62,  64,  66,  68,  70,  72,  74,  76,
        78,  80,  82,  84,  86,  88,  90,  92,  94,  96,  98, 100, 102,
       104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128,
       130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154,
       156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180,
       182, 184, 186, 188, 190, 192, 194, 196, 198], dtype=int64)
array([  1,   3,   5,   7,   9,  11,  12,  15,  17,  19,  20,  22,  24,
        27,  28,  30,  33,  35,  37,  39,  41,  43,  45,  47,  49,  51,
        53,  54,  57,  58,  60,  62,  64,  66,  68,  71,  72,  74,  77,
        79,  81,  82,  85,  86,  89,  91,  93,  95,  96,  99, 101, 103,
       105, 107, 108, 111, 112, 115, 117, 119, 120, 123, 124, 127, 129,
       131, 132, 135, 137, 139, 141, 142, 144, 147, 148, 151, 153, 154,
       157, 159, 161, 163, 164, 166, 168, 171, 173, 175, 176, 179, 181,
       182, 185, 187, 188, 190, 192, 194, 197, 199], dtype=int64)

It seems to be youre right - a Numpy bug then.

Thanks for your help!!!

Note: See TracTickets for help on using tickets.