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

Method test_from_index

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

Source from the content-addressed store, hash-verified

143 self.assertEqual(bytes(a), b'*' * 1000) # should not crash
144
145 def test_from_index(self):
146 b = self.type2test([Indexable(), Indexable(1), Indexable(254),
147 Indexable(255)])
148 self.assertEqual(list(b), [0, 1, 254, 255])
149 self.assertRaises(ValueError, self.type2test, [Indexable(-1)])
150 self.assertRaises(ValueError, self.type2test, [Indexable(256)])
151
152 def test_from_buffer(self):
153 a = self.type2test(array.array('B', [1, 2, 3]))

Callers

nothing calls this directly

Calls 5

listClass · 0.85
type2testMethod · 0.80
IndexableClass · 0.70
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected