def test_validate(self): spec = FrameIDSpec("name", 3) self.assertRaises(ValueError, spec.validate, None, u"123") self.assertRaises(ValueError, spec.validate, None, u"TXXX") self.assertEqual(spec.validate(None, u"TXX"), u"TXX") spec = FrameIDSpec("name", 4) self.assertEqual(spec.validate(None, u"TXXX"), u"TXXX")
def test_read(self): spec = FrameIDSpec("name", 3) self.assertEqual(spec.read(None, None, b"FOOX"), (u"FOO", b"X"))