示例#1
0
def test_respond_frame_csv(nav):
    x = nav.to_frame(name="Maffay")
    response = respond_pandas(x, "csv")
    f = pd.read_csv(StringIO(response.data.decode("utf-8")),
                    index_col=0,
                    header=0,
                    parse_dates=True)
    pdt.assert_frame_equal(f, x, check_names=False)
示例#2
0
def test_respond_json():
    x = ["A", "B"]
    response = respond_pandas(x, "json")
    #print(response.data)
    assert json.loads(response.data) == ["A", "B"]
示例#3
0
def json():
    return respond_pandas(object=frame, format="json")
示例#4
0
def test_respond_frame_json(nav):
    x = nav.to_frame(name="Maffay")
    response = respond_pandas(x, "json")
    pdt.assert_frame_equal(
        pd.read_json(response.data, typ="frame", orient="table"), x)
示例#5
0
def csv():
    return respond_pandas(object=frame, format="csv")