summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_memoryview.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_memoryview.py')
-rw-r--r--Lib/test/test_memoryview.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_memoryview.py b/Lib/test/test_memoryview.py
index ddd5b9a..ca307d8 100644
--- a/Lib/test/test_memoryview.py
+++ b/Lib/test/test_memoryview.py
@@ -362,6 +362,17 @@ class AbstractMemoryTests:
self.assertEqual(list(reversed(m)), aslist)
self.assertEqual(list(reversed(m)), list(m[::-1]))
+ def test_toreadonly(self):
+ for tp in self._types:
+ b = tp(self._source)
+ m = self._view(b)
+ mm = m.toreadonly()
+ self.assertTrue(mm.readonly)
+ self.assertTrue(memoryview(mm).readonly)
+ self.assertEqual(mm.tolist(), m.tolist())
+ mm.release()
+ m.tolist()
+
def test_issue22668(self):
a = array.array('H', [256, 256, 256, 256])
x = memoryview(a)