示例#1
0
def test_getPath(obj) :
    print common.__function_name__()
    testList = [ [ u'',      u'database\\'],
                 [ u'month', u'database\\month\\'],
                 [ u'Month', u'database\\month\\'],
                 [ u'week',  u'database\\week\\'],
                 [ u'Week',  u'database\\week\\'],
                 [ u'day',   u'database\\day\\'],
                 [ u'Day',   u'database\\day\\'],
                 [ u'Minute',u'database\\minute\\'],
                 [ u'minute',u'database\\minute\\'],
                 [ u'Tick',  u'database\\tick\\'],
                 [ u'tick',  u'database\\tick\\'],
                 [ u'M',     u'database\\month\\'],
                 [ u'W',     u'database\\week\\'],
                 [ u'w',     u'database\\week\\'],
                 [ u'D',     u'database\\day\\'],
                 [ u'd',     u'database\\day\\'],
                 [ u'm',     u'database\\minute\\'],
                 [ u'T',     u'database\\tick\\'],
                 [ u't',     u'database\\tick\\'] ]
    for testSet in testList :
        result = obj.getPath(testSet[0])
        if result.value != testSet[1] :
            print testSet,resultList.dump()
示例#2
0
def test_getChartType(obj) :
    print common.__function_name__()
    testList = [ [ u'month', u'M'],
                 [ u'Month', u'M'],
                 [ u'M',     u'M'],
                 [ u'Week',  u'W'],
                 [ u'week',  u'W'],
                 [ u'W',     u'W'],
                 [ u'w',     u'W'],
                 [ u'Day',   u'D'],
                 [ u'day',   u'D'],
                 [ u'D',     u'D'],
                 [ u'd',     u'd'],
                 [ u'Minute',u'm'],
                 [ u'minute',u'm'],
                 [ u'm',     u'm'],
                 [ u'Time',  u'm'],
                 [ u'time',  u'm'],
                 [ u'T',     u'T'],
                 [ u't',     u'T'],
                 [ u'Tick',  u'T'],
                 [ u'tick',  u'T'] ]
    for testSet in testList :
        result = obj.getChartType(testSet[0])
        if result.value != testSet[1] :
            print testSet, result.dump()
示例#3
0
def test_getFileName(obj) :
    print common.__function_name__()
    testList = [ [ u'day',u'A000660',
                  [u'getFileName', u'database\\day\\A000660.data', u'ok'] ],
                 [ u'month',u'A000000',
                  [u'getFileName', u'', u'failed to find stock name of "A000000"'] ],
                 [ u'time',u'',
                  [u'getFileName', u'', u'invalid argStockCode'] ] ]
    for testSet in testList :
        result = obj.getFileName(testSet[0],testSet[1])
        if result.getList() != testSet[2] :
            print testSet, result.dump()
示例#4
0
def test_updateDataList(obj):
    print common.__function_name__()
    chartType = obj.getChartType(u'day')
    requestType = u'count'  #period
    requestArg = 4 
    corrPriceType = 0
    fieldList = [u'날짜',u'시가',u'고가',u'저가',u'종가',u'전일대비',u'거래량',
                 u'거래대금',u'시가총액',u'외국인현보유수량',u'외국인현보유비율',
                 u'수정주가일자',u'수정주가비율',u'기관순매수']
    stockCode = u'A000660'
    result = obj.updateDataList( chartType.value, requestType, requestArg, corrPriceType,
                                 fieldList, stockCode )
    if result.result != u'ok' :
        print result.result
    else :
        """
        # 그닥 찍을만한 내용이 없는 듯.
        for resultList in result.value :
            for itemDic in resultList[5] :  # header list
                for key in itemDic.keys() :
                    print itemDic[key][1], itemDic[key][2]
                print
        """
        
        bFirstPrint = True
        fieldNameList = []
        valueList = []
        for resultList in result.value :
            for itemDic in resultList[6] :  # data list
                for key in itemDic.keys() :
                    if bFirstPrint == True :
                        fieldNameList.append(itemDic[key][1])
                        valueList.append(itemDic[key][2])
                    else :
                        print itemDic[key][2],
                if bFirstPrint == True :
                    for fieldName in fieldNameList :
                        print fieldName,
                    print
                    for value in valueList :
                        print value,
                    bFirstPrint = False
                print
    return