コード例 #1
0
def printvarindex(fname):
    """print the var index"""
    cursor = eplussql.getcursor(fname)
    mtx1 = eplussql.get_varindex(cursor)
    mtx2 = [[str(item) for item in row] for row in mtx1]
    mtx3 = [','.join(row) for row in mtx2]
    for row in mtx3:
        print row
コード例 #2
0
def test_get_varindex():
    """py.test for get_varindex"""
    data = (
        (
            "./eplussql_test/eplussql.sql",
            [
                ["Index", "KeyValue", "VariableName", "VariableUnits"],
                [6, u"Environment", u"Outdoor Dry Bulb", u"C"],
                [7, u"Environment", u"Outdoor Wet Bulb", u"C"],
                [8, u"Environment", u"Outdoor Relative Humidity", u"%"],
            ],
        ),  # fname, indexmatrix
    )
    for fname, indexmatrix in data:
        cursor = eplussql.getcursor(fname)
        result = eplussql.get_varindex(cursor)
        assert result == indexmatrix
コード例 #3
0
def printvarindex(fname):
    """print varindex in csv format"""
    cursor = eplussql.getcursor(fname)
    mtx = eplussql.get_varindex(cursor)
    for row in mtx:
        print "%s,%s,%s,%s" % tuple(row)