8000 Pandas fix by charris · Pull Request #50 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Pandas fix #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
9 commits merged into from
Mar 10, 2011
Prev Previous commit
Next Next commit
DOC: Make clear that class in test breaks the sequence protocol.
  • Loading branch information
charris committed Mar 9, 2011
commit ea403b5c993f5c897480d8bb273501fc30be55f8
12 changes: 9 additions & 3 deletions numpy/core/tests/test_multiarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,15 +303,21 @@ def test_from_string(self) :
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))

Expand Down
0