Lines Matching refs:bytearray

307         for f in bytes, bytearray:
324 b = bytearray([0x1a, 0x2b, 0x30])
362 self.assertFalse(bytearray().endswith(b"anything"))
548 type2test = bytearray
551 self.assertRaises(TypeError, hash, bytearray())
563 b = bytearray(20)
582 b = bytearray(b'hello')
585 b = bytearray(b'hello1') # test even number of items
588 b = bytearray()
594 return bytearray(map(ord, s))
599 b = bytearray([1, 2, 3])
601 self.assertEqual(b, bytearray([1, 100, 3]))
603 self.assertEqual(b, bytearray([1, 100, 200]))
605 self.assertEqual(b, bytearray([10, 100, 200]))
633 b = bytearray(range(10))
635 self.assertEqual(b, bytearray(range(1, 10)))
637 self.assertEqual(b, bytearray(range(1, 9)))
639 self.assertEqual(b, bytearray([1, 2, 3, 4, 6, 7, 8]))
642 b = bytearray(range(10))
645 b[0:5] = bytearray([1, 1, 1, 1, 1])
646 self.assertEqual(b, bytearray([1, 1, 1, 1, 1, 5, 6, 7, 8, 9]))
649 self.assertEqual(b, bytearray([5, 6, 7, 8, 9]))
651 b[0:0] = bytearray([0, 1, 2, 3, 4])
652 self.assertEqual(b, bytearray(range(10)))
654 b[-7:-3] = bytearray([100, 101])
655 self.assertEqual(b, bytearray([0, 1, 2, 100, 101, 7, 8, 9]))
658 self.assertEqual(b, bytearray(range(10)))
661 self.assertEqual(b, bytearray([0, 1, 2, 42, 42, 42, 3, 4, 5, 6, 7, 8, 9]))
664 self.assertEqual(b, bytearray([0, 1, 2, 102, 111, 111]))
667 self.assertEqual(b, bytearray([102, 111, 111, 102, 111, 111]))
670 self.assertEqual(b, bytearray([102, 111, 111, 111, 111]))
673 self.assertEqual(b, bytearray([102, 117, 117, 117, 117]))
690 b = bytearray(L)
697 self.assertEqual(b, bytearray(L))
701 self.assertEqual(b, bytearray(L))
706 b = bytearray(range(256))
708 self.assertEqual(b, bytearray(list(range(8)) + list(range(256))))
711 b = bytearray(b"abc")
727 b = bytearray(b"abc")
735 b = bytearray(b"x")
743 b = bytearray()
755 b = bytearray()
773 a = bytearray(orig)
777 a = bytearray(b'')
783 a = bytearray(b'')
787 a = bytearray(b'')
791 a = bytearray(b'')
795 a = bytearray(b'')
800 b = bytearray(b'hello')
817 c = bytearray([126, 127, 128, 129])
819 self.assertEqual(c, bytearray([126, 128, 129]))
821 self.assertEqual(c, bytearray([126, 128]))
824 b = bytearray(b'world')
829 self.assertRaises(IndexError, lambda: bytearray().pop())
831 self.assertEqual(bytearray(b'\xff').pop(), 0xff)
834 self.assertRaises(AttributeError, lambda: bytearray().sort())
837 b = bytearray(b'hell')
841 b = bytearray()
845 b = bytearray()
850 b = bytearray(b'msssspp')
858 b = bytearray()
865 b = bytearray(b'abc')
868 t = bytearray([i for i in range(256)])
869 x = bytearray(b'')
873 a, b, c = bytearray(b"x").partition(b"y")
879 a, b, c = bytearray(b"x").partition(b"y")
883 b, c, a = bytearray(b"x").rpartition(b"y")
889 c, b, a = bytearray(b"x").rpartition(b"y")
898 b = bytearray(range(10))
929 self.assertRaises(ValueError, int, bytearray(b''))
950 self.assertEqual(f(bytearray()), "bytearray(b'')")
951 self.assertEqual(f(bytearray([0])), "bytearray(b'\\x00')")
952 self.assertEqual(f(bytearray([0, 1, 254, 255])),
989 self.assertIsNotNone(bytearray.__doc__)
990 self.assertTrue(bytearray.__doc__.startswith("bytearray("), bytearray.__doc__)
997 b = bytearray(buf)
998 self.assertEqual(b, bytearray(sample))
1005 self.assertEqual(str(bytearray(b'')), "bytearray(b'')")
1006 self.assertEqual(str(bytearray(b'x')), "bytearray(b'x')")
1007 self.assertEqual(str(bytearray(b'\x80')), "bytearray(b'\\x80')")
1017 self.assertEqual(b, bytearray(s, 'latin-1'))
1024 ba = bytearray(b)
1025 rosetta = bytearray(range(0, 256))
1063 return bytearray(x)
1086 type2test = bytearray
1104 class ByteArraySubclass(bytearray):
1110 self.assertTrue(issubclass(ByteArraySubclass, bytearray))
1111 self.assertIsInstance(ByteArraySubclass(), bytearray)
1138 s2 = bytearray().join([s1])
1140 self.assertTrue(type(s2) is bytearray, type(s2))
1144 self.assertTrue(type(s3) is bytearray)
1173 class subclass(bytearray):
1175 bytearray.__init__(self, *args, **kwargs)