• Home
  • Raw
  • Download

Lines Matching refs:bytearray

240         for f in bytes, bytearray:
257 b = bytearray([0x1a, 0x2b, 0x30])
295 self.assertFalse(bytearray().endswith(b"anything"))
481 type2test = bytearray
484 self.assertRaises(TypeError, hash, bytearray())
496 b = bytearray(20)
515 b = bytearray(b'hello')
518 b = bytearray(b'hello1') # test even number of items
521 b = bytearray()
527 return bytearray(map(ord, s))
532 b = bytearray([1, 2, 3])
534 self.assertEqual(b, bytearray([1, 100, 3]))
536 self.assertEqual(b, bytearray([1, 100, 200]))
538 self.assertEqual(b, bytearray([10, 100, 200]))
566 b = bytearray(range(10))
568 self.assertEqual(b, bytearray(range(1, 10)))
570 self.assertEqual(b, bytearray(range(1, 9)))
572 self.assertEqual(b, bytearray([1, 2, 3, 4, 6, 7, 8]))
575 b = bytearray(range(10))
578 b[0:5] = bytearray([1, 1, 1, 1, 1])
579 self.assertEqual(b, bytearray([1, 1, 1, 1, 1, 5, 6, 7, 8, 9]))
582 self.assertEqual(b, bytearray([5, 6, 7, 8, 9]))
584 b[0:0] = bytearray([0, 1, 2, 3, 4])
585 self.assertEqual(b, bytearray(range(10)))
587 b[-7:-3] = bytearray([100, 101])
588 self.assertEqual(b, bytearray([0, 1, 2, 100, 101, 7, 8, 9]))
591 self.assertEqual(b, bytearray(range(10)))
594 self.assertEqual(b, bytearray([0, 1, 2, 42, 42, 42, 3, 4, 5, 6, 7, 8, 9]))
597 self.assertEqual(b, bytearray([0, 1, 2, 102, 111, 111]))
600 self.assertEqual(b, bytearray([102, 111, 111, 102, 111, 111]))
603 self.assertEqual(b, bytearray([102, 111, 111, 111, 111]))
606 self.assertEqual(b, bytearray([102, 117, 117, 117, 117]))
623 b = bytearray(L)
630 self.assertEqual(b, bytearray(L))
634 self.assertEqual(b, bytearray(L))
639 b = bytearray(range(256))
641 self.assertEqual(b, bytearray(list(range(8)) + list(range(256))))
644 b = bytearray(b"abc")
660 b = bytearray(b"abc")
668 b = bytearray(b"x")
676 b = bytearray()
688 b = bytearray()
706 a = bytearray(orig)
710 a = bytearray(b'')
716 a = bytearray(b'')
720 a = bytearray(b'')
724 a = bytearray(b'')
728 a = bytearray(b'')
733 b = bytearray(b'hello')
750 c = bytearray([126, 127, 128, 129])
752 self.assertEqual(c, bytearray([126, 128, 129]))
754 self.assertEqual(c, bytearray([126, 128]))
757 b = bytearray(b'world')
762 self.assertRaises(IndexError, lambda: bytearray().pop())
764 self.assertEqual(bytearray(b'\xff').pop(), 0xff)
767 self.assertRaises(AttributeError, lambda: bytearray().sort())
770 b = bytearray(b'hell')
774 b = bytearray()
778 b = bytearray()
783 b = bytearray(b'msssspp')
791 b = bytearray()
798 b = bytearray(b'abc')
801 t = bytearray([i for i in range(256)])
802 x = bytearray(b'')
806 a, b, c = bytearray(b"x").partition(b"y")
812 a, b, c = bytearray(b"x").partition(b"y")
816 b, c, a = bytearray(b"x").rpartition(b"y")
822 c, b, a = bytearray(b"x").rpartition(b"y")
831 b = bytearray(range(10))
862 self.assertRaises(ValueError, int, bytearray(b''))
883 self.assertEqual(f(bytearray()), "bytearray(b'')")
884 self.assertEqual(f(bytearray([0])), "bytearray(b'\\x00')")
885 self.assertEqual(f(bytearray([0, 1, 254, 255])),
922 self.assertIsNotNone(bytearray.__doc__)
923 self.assertTrue(bytearray.__doc__.startswith("bytearray("), bytearray.__doc__)
930 b = bytearray(buf)
931 self.assertEqual(b, bytearray(sample))
938 self.assertEqual(str(bytearray(b'')), "bytearray(b'')")
939 self.assertEqual(str(bytearray(b'x')), "bytearray(b'x')")
940 self.assertEqual(str(bytearray(b'\x80')), "bytearray(b'\\x80')")
950 self.assertEqual(b, bytearray(s, 'latin-1'))
957 ba = bytearray(b)
958 rosetta = bytearray(range(0, 256))
996 return bytearray(x)
1019 type2test = bytearray
1037 class ByteArraySubclass(bytearray):
1043 self.assertTrue(issubclass(ByteArraySubclass, bytearray))
1044 self.assertIsInstance(ByteArraySubclass(), bytearray)
1071 s2 = bytearray().join([s1])
1073 self.assertTrue(type(s2) is bytearray, type(s2))
1077 self.assertTrue(type(s3) is bytearray)
1106 class subclass(bytearray):
1108 bytearray.__init__(self, *args, **kwargs)