zoukankan      html  css  js  c++  java
  • generateCitySearcherDic.py

    import pymssql
    import logging
    from DataCleaning.library.functions.getFileNames import *
    from DataCleaning.library.functions.readXlsxFile import *
    from DataCleaning.library.functions.getTwoSheets import *
    from DataCleaning.library.functions.floatFormatter import *
    from DataCleaning.library.functions.addPath import *

    addPath("config")
    from config import *


    def generateCitySearcherDic(cursor):
    countrySearcherFile = getFileNamesInExternal()
    bkTemp = readXlsxFileInExternal(countrySearcherFile)
    sh1, sh2 = getTwoSheets(bkTemp)
    citySearcherDic = {}

    getMap = 'SELECT * FROM ' + countryNameMapping
    cursor.execute(getMap)
    rs = cursor.fetchall()
    for i in rs:
    citySearcherDic[i[2].upper()] = [i[3], i[2], i[4]]

    # from excel mapping
    for i in range(1, sh1.nrows):
    if sh1.cell(i, 3).value != "":
    citySearcherDic[str(sh1.cell(i, 3).value).upper()] =
    [sh1.cell(i, 8).value, sh1.cell(i, 10).value, sh1.cell(i, 11).value]
    if sh1.cell(i, 5).value != "":
    citySearcherDic[str(sh1.cell(i, 5).value).upper()] =
    [sh1.cell(i, 8).value, sh1.cell(i, 10).value, sh1.cell(i, 11).value]
    if sh1.cell(i, 6).value != "":
    citySearcherDic[floatFormatter(sh1.cell(i, 6).value)] =
    [sh1.cell(i, 8).value, sh1.cell(i, 10).value, sh1.cell(i, 11).value]


    invalidFSL = []
    cityNameDic = {"EMEA HUB": "EMEA HUB", "CDC HUB": "CDC HUB"}
    for i in range(1, sh2.nrows):
    if len(sh2.cell(i, 8).value) > 6 and "but" not in sh2.cell(i, 8).value:
    invalidFSL.append(sh2.cell(i, 3).value)
    if sh2.cell(i, 4).value != "":
    cityNameDic[sh2.cell(i, 3).value] = sh2.cell(i, 4).value
    return citySearcherDic, invalidFSL, cityNameDic

  • 相关阅读:
    Josh Christie's blog翻译
    [翻译]自定义提取规则通过索引提取窗体字段
    [翻译]为什么我不能生成更多的负载?
    [翻译]我能从一个Web测试调用另一个Web测试吗?
    [翻译]Web测试记录器
    [翻译]Web测试提取和验证规则
    测试常见错误(1)
    关于VSTE资料的说明
    [翻译]使用自定义IHttpBody类扩展Web测试
    MSDN上终于有了Tester Center
  • 原文地址:https://www.cnblogs.com/zhulimin/p/15369466.html
Copyright © 2011-2022 走看看