http://codereview.appspot.com/3004/diff/1/4 File Lib/test/test_memoryview.py (right): http://codereview.appspot.com/3004/diff/1/4#newcode11 Line 11: class CommonMemoryTests: On 2008/08/19 19:59:52, Benjamin wrote: > ...
16 years, 5 months ago
(2008-08-19 20:12:47 UTC)
#2
http://codereview.appspot.com/3004/diff/1/4
File Lib/test/test_memoryview.py (right):
http://codereview.appspot.com/3004/diff/1/4#newcode11
Line 11: class CommonMemoryTests:
On 2008/08/19 19:59:52, Benjamin wrote:
> Since you name the tests explicitly in test_main, why don't you just make
> CommonMemoryTests inherit from TestCase?
Well it clearly signals that CommonMemoryTests is not a test case in itself.
http://codereview.appspot.com/3004/diff/1/4#newcode18
Line 18: def _test_getitem_with_type(self, tp):
On 2008/08/19 19:59:52, Benjamin wrote:
> Instead of using _ in front of these, I think you should name them check_*.
(ie
> check_getitem_with_type)
Ok, I'll do it.
http://codereview.appspot.com/3004/diff/1/4#newcode163
Line 163: def _view(self, obj):
On 2008/08/19 19:59:52, Benjamin wrote:
> Why not just make this an attribute?
Mmmh, because it's a method? :)
See other classes below.
http://codereview.appspot.com/3004/diff/1/4#newcode196
Line 196: class MemorySliceSliceTest(unittest.TestCase, CommonMemoryTests):
On 2008/08/19 19:59:52, Benjamin wrote:
> How are a slice and a slice of a slice different enough that they need
separate
> test cases?
There may be some edge cases, depending on the fact that the memoryview has a
"base" field or not, its format, shape etc. Better safe than sorry.
http://codereview.appspot.com/3004/diff/1/2
File Objects/memoryobject.c (right):
http://codereview.appspot.com/3004/diff/1/2#newcode416
Line 416: "tolist() only accepts one-dimensional objects");
On 2008/08/19 19:59:52, Benjamin wrote:
> "accepts" should be "supports"
Ok.
http://codereview.appspot.com/3004/diff/1/2#newcode787
Line 787: memory_richcompare, /* tp_richcompare */
On 2008/08/19 19:59:52, Benjamin wrote:
> Looks like /* tp_richcompare */ needs to be reindented.
Indeed.
http://codereview.appspot.com/3004/diff/10/31 File Objects/memoryobject.c (right): http://codereview.appspot.com/3004/diff/10/31#newcode606 Line 606: PyErr_SetNone(PyExc_NotImplementedError); On 2008/08/19 21:19:24, Benjamin wrote: > I ...
16 years, 5 months ago
(2008-08-19 21:40:09 UTC)
#5
http://codereview.appspot.com/3004/diff/10/31
File Objects/memoryobject.c (right):
http://codereview.appspot.com/3004/diff/10/31#newcode606
Line 606: PyErr_SetNone(PyExc_NotImplementedError);
On 2008/08/19 21:19:24, Benjamin wrote:
> I think you want a "return NULL;" after this or it will fall through to the
type
> error. You also might as well add tests for these exceptions.
Yes! Nice catch.
http://codereview.appspot.com/3004/diff/10/31#newcode621
Line 621: Py_buffer *view = &(self->view);
On 2008/08/19 21:19:24, Benjamin wrote:
> It's a bit confusing when you call Py_buffer variables "view" when there's
> another struct called PyMemoryView.
I know, but it's a convention used throughout this file. We can clean it up
later.
Issue 3004: (not quite finished) memoryview implementation
(Closed)
Created 16 years, 5 months ago by Antoine Pitrou
Modified 4 years, 8 months ago
Reviewers: Benjamin, GvR, tangyq_yoozoo.com
Base URL: http://svn.python.org/view/*checkout*/python/branches/py3k/
Comments: 17