diff options
author | Stefan Krah <skrah@bytereef.org> | 2015-01-29 13:29:51 (GMT) |
---|---|---|
committer | Stefan Krah <skrah@bytereef.org> | 2015-01-29 13:29:51 (GMT) |
commit | f5324d7074d17b026ecd5ef7d7fc16f5e71b0db2 (patch) | |
tree | 0b5d602bf7d5372ed54df211b3ebc31b21f59653 /Lib/test/test_memoryview.py | |
parent | 6d14405fdb9357b689d76dcfd230018c0ce8c3a8 (diff) | |
parent | fa5d6a5ff3ca247d9c2eaf51853ff39c98c09f4a (diff) | |
download | cpython-f5324d7074d17b026ecd5ef7d7fc16f5e71b0db2.zip cpython-f5324d7074d17b026ecd5ef7d7fc16f5e71b0db2.tar.gz cpython-f5324d7074d17b026ecd5ef7d7fc16f5e71b0db2.tar.bz2 |
Closes #22668: Merge from 3.4.
Diffstat (limited to 'Lib/test/test_memoryview.py')
-rw-r--r-- | Lib/test/test_memoryview.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_memoryview.py b/Lib/test/test_memoryview.py index e7df8a7..bd9d0d4 100644 --- a/Lib/test/test_memoryview.py +++ b/Lib/test/test_memoryview.py @@ -360,6 +360,25 @@ class AbstractMemoryTests: self.assertEqual(list(reversed(m)), aslist) self.assertEqual(list(reversed(m)), list(m[::-1])) + def test_issue22668(self): + m = memoryview(bytes(range(8))) + b = m.cast('H') + c = b[0:2] + d = memoryview(b) + + del b + + self.assertEqual(c[0], 256) + self.assertEqual(d[0], 256) + self.assertEqual(c.format, "H") + self.assertEqual(d.format, "H") + + _ = m.cast('I') + self.assertEqual(c[0], 256) + self.assertEqual(d[0], 256) + self.assertEqual(c.format, "H") + self.assertEqual(d.format, "H") + # Variations on source objects for the buffer: bytes-like objects, then arrays # with itemsize > 1. |