Author: Brian Kearns <[email protected]>
Branch:
Changeset: r71690:c3bdd9af8ac0
Date: 2014-05-23 18:32 -0400
http://bitbucket.org/pypy/pypy/changeset/c3bdd9af8ac0/
Log: test frombuffer using __buffer__ attribute
diff --git a/pypy/module/micronumpy/test/test_ndarray.py
b/pypy/module/micronumpy/test/test_ndarray.py
--- a/pypy/module/micronumpy/test/test_ndarray.py
+++ b/pypy/module/micronumpy/test/test_ndarray.py
@@ -3174,6 +3174,14 @@
exc = raises(ValueError, "a[2] = 'Z'")
assert str(exc.value) == "assignment destination is read-only"
+ class A(object):
+ __buffer__ = 'abc'
+
+ data = A()
+ a = np.frombuffer(data, 'c')
+ #assert a.base is data.__buffer__
+ assert a.tostring() == 'abc'
+
def test_fromstring(self):
import sys
from numpypy import fromstring, dtype
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit