Skip to content

Commit d311794

Browse files
committed
increase test coverage
1 parent 2e3d8a7 commit d311794

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Lib/test/test_memoryview.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,18 @@ def _view(self, obj):
454454
def _check_contents(self, tp, obj, contents):
455455
self.assertEqual(obj, tp(contents))
456456

457+
def test_count(self):
458+
super().test_count()
459+
for tp in self._types:
460+
b = tp((b'a' * 5) + (b'c' * 3))
461+
m = self._view(b) # should not be sliced
462+
self.assertEqual(len(b), len(m))
463+
with self.subTest('count', buffer=b):
464+
self.assertEqual(m.count(ord('a')), 5)
465+
self.assertEqual(m.count(ord('b')), 0)
466+
self.assertEqual(m.count(ord('c')), 3)
467+
468+
457469
class BaseMemorySliceTests:
458470
source_bytes = b"XabcdefY"
459471

0 commit comments

Comments
 (0)