コード例 #1
0
 def get_doc_by_url(self, url):
     self.counter += 1
     doc = common.ADocument()
     doc.url = url
     doc.meta_data = types.DocMetaData(None, None, url, url, int(url), url,
                                       [0, 0, 0])
     doc.real_data = types.DocRealData(url, [])
     return doc
コード例 #2
0
 def get_doc_by_id(self, idid):
     doc = common.ADocument()
     doc.url = str(idid)
     doc.meta_data = types.DocMetaData(idid, idid, 'meow', 'wang', idid,
                                       None, [0, 0, 0])
     doc.real_data = types.DocRealData(str(self.last_time), [])
     self.num_called += 1
     return doc
コード例 #3
0
 def get_doc_by_url(self, url):
     doc = common.ADocument()
     doc.url = url
     doc.meta_data = types.DocMetaData(int(url), int(url), 'meow', 'wang',
                                       int(url), None, [0, 0, 0])
     doc.real_data = types.DocRealData(str(self.last_time), [])
     self.num_called += 1
     return doc
コード例 #4
0
 def runTest(self):
     r1 = types.ReplyMessage(2, 'a', 'bb')
     r2 = types.ReplyMessage(1, 'b', 'cc')
     drd = types.DocRealData('wu lala', [r1, r2])
     buf = b''.join([
         b'\x07\x00\x00\x00\x00\x00\x00\x00wu lala',
         b'\x02\x00\x00\x00\x00\x00\x00\x00',
         r1.dump(),
         r2.dump()
     ])
     self.assertEqual(drd.dump(), buf)
コード例 #5
0
 def get_doc_real_data(self, board, idid):
     r1 = types.ReplyMessage(types.ReplyMode.GOOD, board + '_r1', 'r1r1')
     r2 = types.ReplyMessage(types.ReplyMode.WOO, board + '_r2', 'r2r2')
     r3 = types.ReplyMessage(types.ReplyMode.NORMAL, board + '_r3', 'r3r3')
     return types.DocRealData(board + board + board, [r1, r2, r3])