def test_timestampspec(self): from mutagen.id3 import TimeStampSpec, Frame, ID3TimeStamp s = TimeStampSpec('name') f = Frame(); f.encoding = 0 self.assertEquals((ID3TimeStamp('ab'), b'fg'), s.read(f, b'ab\x00fg')) self.assertEquals((ID3TimeStamp('1234'), b''), s.read(f, b'1234\x00')) self.assertEquals(b'1234\x00', s.write(f, ID3TimeStamp('1234'))) self.assertRaises(AttributeError, s.write, f, None)
def test_timestampspec(self): from mutagen.id3 import TimeStampSpec, Frame, ID3TimeStamp s = TimeStampSpec("name") f = Frame() f.encoding = 0 self.assertEquals((ID3TimeStamp("ab"), "fg"), s.read(f, "ab\x00fg")) self.assertEquals((ID3TimeStamp("1234"), ""), s.read(f, "1234\x00")) self.assertEquals("1234\x00", s.write(f, ID3TimeStamp("1234"))) self.assertRaises(AttributeError, s.write, f, None)
def test_timestampspec(self): from mutagen.id3 import TimeStampSpec, Frame, ID3TimeStamp s = TimeStampSpec('name') f = Frame() f.encoding = 0 self.assertEquals((ID3TimeStamp('ab'), b'fg'), s.read(f, b'ab\x00fg')) self.assertEquals((ID3TimeStamp('1234'), b''), s.read(f, b'1234\x00')) self.assertEquals(b'1234\x00', s.write(f, ID3TimeStamp('1234'))) self.assertRaises(AttributeError, s.write, f, None) if PY3: self.assertRaises(TypeError, ID3TimeStamp, b"blah") self.assertEquals(text_type(ID3TimeStamp(u"2000-01-01")), u"2000-01-01") self.assertEquals(bytes(ID3TimeStamp(u"2000-01-01")), b"2000-01-01")
def test_timestampspec(self): from mutagen.id3 import TimeStampSpec, Frame, ID3TimeStamp s = TimeStampSpec('name') f = Frame(); f.encoding = 0 self.assertEquals((ID3TimeStamp('ab'), b'fg'), s.read(f, b'ab\x00fg')) self.assertEquals((ID3TimeStamp('1234'), b''), s.read(f, b'1234\x00')) self.assertEquals(b'1234\x00', s.write(f, ID3TimeStamp('1234'))) self.assertRaises(AttributeError, s.write, f, None) if PY3: self.assertRaises(TypeError, ID3TimeStamp, b"blah") self.assertEquals( text_type(ID3TimeStamp(u"2000-01-01")), u"2000-01-01") self.assertEquals( bytes(ID3TimeStamp(u"2000-01-01")), b"2000-01-01")