def ipcompileTest(self):

        #channel.channelkeywordall()
        error = 0
        for n in range(len(channel.channelkeywordall())):
            urlvluecompile = url.url_keyword(china_decode.chinese_decode(str(channel.channelkeywordall()[n])))
            urlvlue = url.url_keyword(china_decode.chinese_decode(str(keyword)))
            if result_compare.compare_result_all(urlvlue,urlvluecompile) == 1:
                print channel.channelkeywordall()[n],"对比结果一致,成功"
            if result_compare.compare_result_all(urlvlue,urlvluecompile) == 0:
                error = error+1
                print channel.channelkeywordall()[n],"对比结果不一致,失败"
        assert error == 0
示例#2
0
 def travelgroup_Test(self):
     typevlue = self.travelgroup.type()
     error = 0
     for n in range(len(self.travelgroup.keyword())):
         keyword = self.travelgroup.keyword()[n]
         urlvlue = url.url_keyword(china_decode.chinese_decode(str(self.travelgroup.keyword()[n])))
         tpyevluecompile = http.get_key_vlue(urlvlue, http.vluecount(urlvlue, "word", keyword), "type")
         if tpyevluecompile == typevlue:
             print self.travelgroup.keyword()[n], "类型正确为", tpyevluecompile
         else:
             error = error + 1
             print self.travelgroup.keyword()[n], "类型错误为", tpyevluecompile
     assert error == 0
示例#3
0
def get_url(file,sheet,row):
   table = read_excel.open_excel(file).sheet_by_name(sheet)
   a1 = 'http://'
   a2 = str(table.cell(row, read_excel.find_colum(file,sheet,'ipport')).value)
   a3 ='/appautocomplete/search?'

   reload(sys)
   b = table.cell(row, read_excel.find_colum(file,sheet,'keyword')).value
   reload(sys)
   sys.setdefaultencoding('utf-8')
   b = str(b)
   a4 = 'keyword='+ china_decode.chinese_decode(b)
   a5 = 'action='+str(table.cell(row, read_excel.find_colum(file,sheet,'action')).value)
   a6 = 'source'+str(table.cell(row, read_excel.find_colum(file,sheet,'source')).value)
   a7 = 'districtid'+str(table.cell(row, read_excel.find_colum(file,sheet,'districtid')).value)
   url = str(a1+a2+a3+a4+'&'+a5+'&'+a6+'&'+a7)
   return url