question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test failures TestNewBufferProtocol.test_error_too_many_dims

See original GitHub issue

See: https://travis-ci.org/MacPython/numpy-wheels/jobs/380655687

________________ TestNewBufferProtocol.test_error_too_many_dims ________________

self = <numpy.core.tests.test_multiarray.TestNewBufferProtocol object at 0xf041f20c>

    def test_error_too_many_dims(self):
        def make_ctype(shape, scalar_type):
            t = scalar_type
            for dim in shape[::-1]:
                t = dim * t
            return t
    
        # construct a memoryview with 33 dimensions
        c_u8_33d = make_ctype((1,)*33, ctypes.c_uint8)
        m = memoryview(c_u8_33d())
        assert_equal(m.ndim, 33)
    
        assert_raises_regex(
            RuntimeError, "ndim",
>           np.array, m)

c_u8_33d   = <class 'numpy.core.tests.test_multiarray.c_ubyte_Array_1_Array_1_Array_1_Array...ay_1_Array_1_Array_1_Array_1_Array_1_Array_1_Array_1_Array_1_Array_1__Array_1'>
m          = <memory at 0xf2da0e3c>
make_ctype = <function make_ctype at 0xf041cb1c>
self       = <numpy.core.tests.test_multiarray.TestNewBufferProtocol object at 0xf041f20c>

/venv/local/lib/python2.7/site-packages/numpy/core/tests/test_multiarray.py:6534: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <numpy.testing._private.utils._Dummy testMethod=nop>
expected_exception = <type 'exceptions.RuntimeError'>, expected_regexp = 'ndim'
callable_obj = <built-in function array>, args = (<memory at 0xf2da0e3c>,)
kwargs = {}, context = <unittest.case._AssertRaisesContext object at 0xf041ff2c>

    def assertRaisesRegexp(self, expected_exception, expected_regexp,
                           callable_obj=None, *args, **kwargs):
        """Asserts that the message in a raised exception matches a regexp.
    
            Args:
                expected_exception: Exception class expected to be raised.
                expected_regexp: Regexp (re pattern object or string) expected
                        to be found in error message.
                callable_obj: Function to be called.
                args: Extra args.
                kwargs: Extra kwargs.
            """
        context = _AssertRaisesContext(expected_exception, self, expected_regexp)
        if callable_obj is None:
            return context
        with context:
>           callable_obj(*args, **kwargs)
E           ValueError: '(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)<B' is not a valid PEP 3118 buffer format string

args       = (<memory at 0xf2da0e3c>,)
callable_obj = <built-in function array>
context    = <unittest.case._AssertRaisesContext object at 0xf041ff2c>
expected_exception = <type 'exceptions.RuntimeError'>
expected_regexp = 'ndim'
kwargs     = {}
self       = <numpy.testing._private.utils._Dummy testMethod=nop>

Only for 32-bit Unicode Python 2.7: https://travis-ci.org/MacPython/numpy-wheels/builds/380655679

Error present at commit db552b5b6 “Merge pull request #10996 from adeak/docfix-stringio-unicode” (23 days ago).

Not present at commit b5c1bcf1e “Merge pull request #10891 from eric-wieser/assert-no-cycles” (25 days ago): https://travis-ci.org/MacPython/numpy-wheels/builds/370054701

In git log b5c1bcf1e..db552b5b6 I noticed references to #10971 and #10882 which both mention buffers - are they relevant?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:25 (25 by maintainers)

github_iconTop GitHub Comments

1reaction
charriscommented, May 23, 2018

Let’s just add a skipif decorator to the test and move on. Don’t see the use of xfail here, as the test will xpass for later versions of Python 2.7 and the test is just there to check the new error message.

0reactions
matthew-brettcommented, May 20, 2018

Why not use the ctypes result to decide whether to run the test?

On Sun, 20 May 2018 2:48 AM Eric Wieser, notifications@github.com wrote:

Not sure how to find the minor version from that commit.

@mattip https://github.com/mattip, since you’ve looked at ctype arrayss before - could I get you to review python/cpython#5576 https://github.com/python/cpython/pull/5576?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/numpy/numpy/issues/11115#issuecomment-390451732, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEIHHaYB4vWtUBKGSo0eDk8uU3O5dLkks5t0MuJgaJpZM4UE2Si .

Read more comments on GitHub >

github_iconTop Results From Across the Web

unittest — Unit testing framework — Python 3.11.1 ...
A test fixture represents the preparation needed to perform one or more ... The standard output and standard error streams are buffered during...
Read more >
make check unit test failures and segmentation fault
I am compiling on board rather than cross compiling, and am failing some unit tests when I run "make check". Most of the...
Read more >
Pilot COVID-19 At-Home Test - FDA
Failure to squeeze the tube can lead to incorrect results due to excess buffer in the swab. Positive result. If the Control line...
Read more >
A 0.85% saline as alternative detection buffer for SD-Bioline ...
SD-Bioline® HIV diagnostic test kits are usually packed with a single diluent buffer whereby in some occasions the buffer supplied tends to be...
Read more >
1910.134 App A - Fit Testing Procedures (Mandatory).
For the modified ambient aerosol CNC quantitative fit testing protocols, ... (8) If the test is failed, the subject shall return to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found