Commit 9357bac8 authored by Kirill Smelkov's avatar Kirill Smelkov

bigarray: Fix flaky test in test_bigarray_indexing_1d

We compare A_[10*PS-1] (which is A_[1]) to 0, but

    A_= ndarray ((10*PS,), uint8)

and that means the array memory is not initialized. So the comparison
works sometimes and sometimes it does not.

Initialize compared element explicitly.

NOTE: A (without _) element does not need to be initialized -
because not-initialized BigArray parts read as zeros.
parent 010eeb35
...@@ -116,6 +116,7 @@ def test_bigarray_indexing_1d(): ...@@ -116,6 +116,7 @@ def test_bigarray_indexing_1d():
# index out of range # index out of range
# - element access -> raises IndexError # - element access -> raises IndexError
# - slice access -> empty # - slice access -> empty
A_[-1] = 0
assert AA[10*PS-1] == (0,0) assert AA[10*PS-1] == (0,0)
raises(IndexError, 'A_[10*PS]') raises(IndexError, 'A_[10*PS]')
raises(IndexError, 'A [10*PS]') raises(IndexError, 'A [10*PS]')
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment