Beispiel #1
0
 def test_python3_strict_str(self):
     comment = VComment()
     comment.append((u"abc", u"test"))
     comment.validate()
     comment[0] = (u"abc", b"test")
     self.failUnlessRaises(ValueError, comment.validate)
     comment[0] = (b"abc", u"test")
     self.failUnlessRaises(ValueError, comment.validate)
Beispiel #2
0
 def test_empty_valid(self):
     self.failIf(VComment(b"\x00\x00\x00\x00" * 2 + b"\x01"))
Beispiel #3
0
 def setUp(self):
     self.c = VComment()
     self.c.append(("artist", u"piman"))
     self.c.append(("artist", u"mu"))
     self.c.append(("title", u"more fakes"))
Beispiel #4
0
 def test_roundtrip_vc(self):
     self.failUnlessEqual(self.c, VComment(self.c.write()))
Beispiel #5
0
 def test_roundtrip(self):
     self.assertReallyEqual(self.c, VComment(self.c.write()))
Beispiel #6
0
 def test_invalid_tag_ignore(self):
     data = (b'\x07\x00\x00\x00Mutagen\x01\x00\x00\x00\x04\x00\x00'
             b'\x00\xc2\xaa=c\x01')
     comment = VComment(data, errors='ignore')
     self.failIf(len(comment))
Beispiel #7
0
 def test_invalid_tag_replace(self):
     data = (b'\x07\x00\x00\x00Mutagen\x01\x00\x00\x00\x04\x00\x00'
             b'\x00\xc2\xaa=c\x01')
     comment = VComment(data)
     self.failUnlessEqual(u"?=c", comment.pprint())
Beispiel #8
0
 def test_invalid_format_ignore(self):
     data = (b'\x07\x00\x00\x00Mutagen\x01\x00\x00\x00\x03\x00\x00'
             b'\x00abc\x01')
     comment = VComment(data, errors='ignore')
     self.failIf(len(comment))
Beispiel #9
0
 def test_python_key_value_type(self):
     data = (b'\x07\x00\x00\x00Mutagen\x01\x00\x00\x00\x03\x00\x00'
             b'\x00abc\x01')
     comment = VComment(data)
     self.assertTrue(isinstance(comment[0][0], type('')))
     self.assertTrue(isinstance(comment[0][1], text_type))
Beispiel #10
0
 def test_invalid_format_replace(self):
     data = (b'\x07\x00\x00\x00Mutagen\x01\x00\x00\x00\x03\x00\x00'
             b'\x00abc\x01')
     comment = VComment(data)
     self.failUnlessEqual(u"abc", comment[0][1])