diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2013-10-02 12:06:54 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2013-10-02 12:06:54 (GMT) |
commit | a0f169cde878f08c2873b0cdf42118439113a96f (patch) | |
tree | 8b9911ccf09128706ab58573512a640a354bec36 /Lib | |
parent | dff9e2535f5bf73f1491edc45928eef51a701074 (diff) | |
download | cpython-a0f169cde878f08c2873b0cdf42118439113a96f.zip cpython-a0f169cde878f08c2873b0cdf42118439113a96f.tar.gz cpython-a0f169cde878f08c2873b0cdf42118439113a96f.tar.bz2 |
Close #19078: memoryview now supports reversed
Patch by Claudiu Popa
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_memoryview.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_memoryview.py b/Lib/test/test_memoryview.py index ee6b15a..ffd4f58 100644 --- a/Lib/test/test_memoryview.py +++ b/Lib/test/test_memoryview.py @@ -352,6 +352,15 @@ class AbstractMemoryTests: self.assertIs(wr(), None) self.assertIs(L[0], b) + def test_reversed(self): + for tp in self._types: + b = tp(self._source) + m = self._view(b) + aslist = list(reversed(m.tolist())) + self.assertEqual(list(reversed(m)), aslist) + self.assertEqual(list(reversed(m)), list(m[::-1])) + + # Variations on source objects for the buffer: bytes-like objects, then arrays # with itemsize > 1. # NOTE: support for multi-dimensional objects is unimplemented. |