Ejemplo n.º 1
0
    def test_unsync_encode_decode(self):
        pairs = [
            (b'', b''),
            (b'\x00', b'\x00'),
            (b'\x44', b'\x44'),
            (b'\x44\xff', b'\x44\xff\x00'),
            (b'\xe0', b'\xe0'),
            (b'\xe0\xe0', b'\xe0\xe0'),
            (b'\xe0\xff', b'\xe0\xff\x00'),
            (b'\xff', b'\xff\x00'),
            (b'\xff\x00', b'\xff\x00\x00'),
            (b'\xff\x00\x00', b'\xff\x00\x00\x00'),
            (b'\xff\x01', b'\xff\x01'),
            (b'\xff\x44', b'\xff\x44'),
            (b'\xff\xe0', b'\xff\x00\xe0'),
            (b'\xff\xe0\xff', b'\xff\x00\xe0\xff\x00'),
            (b'\xff\xf0\x0f\x00', b'\xff\x00\xf0\x0f\x00'),
            (b'\xff\xff', b'\xff\x00\xff\x00'),
            (b'\xff\xff\x01', b'\xff\x00\xff\x01'),
            (b'\xff\xff\xff\xff', b'\xff\x00\xff\x00\xff\x00\xff\x00'),
        ]

        for d, e in pairs:
            self.assertEqual(unsynch.encode(d), e)
            self.assertEqual(unsynch.decode(e), d)
            self.assertEqual(unsynch.decode(unsynch.encode(e)), e)
            self.assertEqual(unsynch.decode(e + e), d + d)
Ejemplo n.º 2
0
 def test_unsync_encode(self):
     from mutagen.id3 import unsynch as un
     for d in (b'\xff\xff\xff\xff', b'\xff\xf0\x0f\x00', b'\xff\x00\x0f\xf0'):
         self.assertEquals(d, un.decode(un.encode(d)))
         self.assertNotEqual(d, un.encode(d))
     self.assertEquals(b'\xff\x44', un.encode(b'\xff\x44'))
     self.assertEquals(b'\xff\x00\x00', un.encode(b'\xff\x00'))
Ejemplo n.º 3
0
 def test_unsync_encode(self):
     from mutagen.id3 import unsynch as un
     for d in (b'\xff\xff\xff\xff', b'\xff\xf0\x0f\x00',
               b'\xff\x00\x0f\xf0'):
         self.assertEquals(d, un.decode(un.encode(d)))
         self.assertNotEqual(d, un.encode(d))
     self.assertEquals(b'\xff\x44', un.encode(b'\xff\x44'))
     self.assertEquals(b'\xff\x00\x00', un.encode(b'\xff\x00'))
Ejemplo n.º 4
0
    def test_unsync_encode(self):
        from mutagen.id3 import unsynch as un

        for d in ("\xff\xff\xff\xff", "\xff\xf0\x0f\x00", "\xff\x00\x0f\xf0"):
            self.assertEquals(d, un.decode(un.encode(d)))
            self.assertNotEqual(d, un.encode(d))
        self.assertEquals("\xff\x44", un.encode("\xff\x44"))
        self.assertEquals("\xff\x00\x00", un.encode("\xff\x00"))