diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2011-03-08 17:56:00 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2011-03-08 17:56:00 -0700 |
commit | ea403b5c993f5c897480d8bb273501fc30be55f8 (patch) | |
tree | f0dd926c190714c239ba58121a21f8749759d09b /numpy | |
parent | 891bc2e8cebc3259f83033eceb2287c9f8eaa555 (diff) | |
download | numpy-ea403b5c993f5c897480d8bb273501fc30be55f8.tar.gz |
DOC: Make clear that class in test breaks the sequence protocol.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index edb64cd61..0c2d55ae6 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -303,15 +303,21 @@ class TestCreation(TestCase): assert_equal(array(nstr, dtype=type), result, err_msg=msg) def test_non_sequence_sequence(self): - """Should not segfault.""" - class x(object): + """Should not segfault. + + Class Foo breaks the sequence protocol for new style classes, i.e., + those derived from object. At some point we may raise a warning in + this case. + + """ + class Foo(object): def __len__(self): return 1 def __getitem__(self): raise ValueError('hi there') - a = np.array([x()]) + a = np.array([Foo()]) assert_(a.shape == (1,)) assert_(a.dtype == np.dtype(object)) |