Skip to content

Commit da0b5a9

Browse files
committed
test
1 parent b42914c commit da0b5a9

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎Lib/test/test_memoryview.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,15 @@ def _check_contents(self, tp, obj, contents):
561561
class BytesMemoryviewTest(unittest.TestCase,
562562
BaseMemoryviewTests, BaseBytesMemoryTests):
563563

564+
def test_compare_byte_views(self):
565+
for fmt in ('B', 'b', 'c'):
566+
with self.subTest(format=fmt):
567+
packed = memoryview(b'ab').cast(fmt)
568+
spaced = memoryview(b'axb').cast(fmt)[::2]
569+
self.assertEqual(packed, spaced)
570+
self.assertEqual(spaced, packed)
571+
self.assertNotEqual(packed, memoryview(b'ax').cast(fmt))
572+
564573
def test_comparison_release_during_buffer_callback(self):
565574
# Releasing the view from inside the other operand's __buffer__
566575
# succeeds, but the buffer stays pinned until the comparison ends:

0 commit comments

Comments
 (0)