~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to Lib/test/test_bytes.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-03-11 13:30:19 UTC
  • mto: (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: james.westby@ubuntu.com-20100311133019-sblbooa3uqrkoe70
Tags: upstream-2.6.5~rc2
ImportĀ upstreamĀ versionĀ 2.6.5~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
569
569
        self.assertEqual(b, bytearray([0, 1, 2, 42, 42, 42, 3, 4, 5, 6, 7, 8, 9]))
570
570
 
571
571
    def test_extended_set_del_slice(self):
572
 
        indices = (0, None, 1, 3, 19, 300, -1, -2, -31, -300)
 
572
        indices = (0, None, 1, 3, 19, 300, 1<<333, -1, -2, -31, -300)
573
573
        for start in indices:
574
574
            for stop in indices:
575
575
                # Skip invalid step 0
787
787
        self.assertRaises(BufferError, delslice)
788
788
        self.assertEquals(b, orig)
789
789
 
 
790
    def test_empty_bytearray(self):
 
791
        # Issue #7561: operations on empty bytearrays could crash in many
 
792
        # situations, due to a fragile implementation of the
 
793
        # PyByteArray_AS_STRING() C macro.
 
794
        self.assertRaises(ValueError, int, bytearray(b''))
 
795
 
 
796
 
790
797
class AssortedBytesTest(unittest.TestCase):
791
798
    #
792
799
    # Test various combinations of bytes and bytearray