MCPcopy Index your code
hub / github.com/python/cpython / test_extended_set_del_slice

Method test_extended_set_del_slice

Lib/test/test_bytes.py:1748–1767  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1746 self.assertLessEqual(sys.getsizeof(b), size)
1747
1748 def test_extended_set_del_slice(self):
1749 indices = (0, None, 1, 3, 19, 300, 1<<333, sys.maxsize,
1750 -1, -2, -31, -300)
1751 for start in indices:
1752 for stop in indices:
1753 # Skip invalid step 0
1754 for step in indices[1:]:
1755 L = list(range(255))
1756 b = bytearray(L)
1757 # Make sure we have a slice of exactly the right length,
1758 # but with different data.
1759 data = L[start:stop:step]
1760 data.reverse()
1761 L[start:stop:step] = data
1762 b[start:stop:step] = data
1763 self.assertEqual(b, bytearray(L))
1764
1765 del L[start:stop:step]
1766 del b[start:stop:step]
1767 self.assertEqual(b, bytearray(L))
1768
1769 def test_setslice_trap(self):
1770 # This test verifies that we correctly handle assigning self

Callers

nothing calls this directly

Calls 3

listClass · 0.85
reverseMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected