示例#1
0
    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")
示例#2
0
    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")
示例#3
0
 def test_read(self):
     spec = FrameIDSpec("name", 3)
     self.assertEqual(spec.read(None, None, b"FOOX"), (u"FOO", b"X"))
示例#4
0
 def test_read(self):
     spec = FrameIDSpec("name", 3)
     self.assertEqual(spec.read(None, None, b"FOOX"), (u"FOO", b"X"))