def testiterator(self): cmo = codecMetaObject(self.root.getroot()) generator = cmo.allItems() item = generator.next() self.assertEquals('version', item.extract('name')) self.assertEquals('integer-reverse', item.extract('type')) result = {'startbyte': '3', 'endbyte': '4'} self.assertEquals(result, item.extractParams()) item = generator.next() self.assertEquals('gmid', item.extract('name')) self.assertEquals('integer-reverse', item.extract('type')) result = {'startbyte': '6', 'endbyte': '8'} self.assertEquals(result, item.extractParams()) item = generator.next() self.assertEquals('gamecycle', item.extract('name')) self.assertEquals('boolean', item.extract('type')) result = {'byte': '9', 'bit': '1'} self.assertEquals(result, item.extractParams()) self.assertEquals(None, item.extract('unicode')) self.assertRaises(StopIteration, generator.next)
def testEssentialMethods(self): cmo = codecMetaObject(self.root.getroot()) self.assertEquals(128, cmo.getPacketLength()) self.assertEquals('sdb', cmo.getPacketName()) self.assertEquals('00', cmo.getPacketPattern())