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

Method test_insert

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

Source from the content-addressed store, hash-verified

1920 self.assertEqual(b, b'A')
1921
1922 def test_insert(self):
1923 b = bytearray(b'msssspp')
1924 b.insert(1, ord('i'))
1925 b.insert(4, ord('i'))
1926 b.insert(-2, ord('i'))
1927 b.insert(1000, ord('i'))
1928 self.assertEqual(b, b'mississippi')
1929 self.assertRaises(TypeError, lambda: b.insert(0, b'1'))
1930 b = bytearray()
1931 b.insert(0, Indexable(ord('A')))
1932 self.assertEqual(b, b'A')
1933
1934 def test_copied(self):
1935 # Issue 4348. Make sure that operations that don't mutate the array

Callers

nothing calls this directly

Calls 4

IndexableClass · 0.70
insertMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected