def test_get_data():
    df = get_data("get_price", security=['000001.XSHE', '000002.XSHE'], fields='close', start_date='2014-12-30',
                        end_date='2015-01-06', fq=None, panel=False)
    df.to_csv().replace('\r', '') == \
""",time,code,close
0,2014-12-30,000001.XSHE,15.5
1,2014-12-31,000001.XSHE,15.84
2,2015-01-05,000001.XSHE,16.02
3,2015-01-06,000001.XSHE,15.78
4,2014-12-30,000002.XSHE,12.64
5,2014-12-31,000002.XSHE,13.9
6,2015-01-05,000002.XSHE,14.91
7,2015-01-06,000002.XSHE,14.36
"""
    for code in (1, '000001', 'SZ000001', '000001SZ', '000001.sz', '000001.XSHE'):
        assert '000001.XSHE' == get_data("normalize_code", code=code)
,time,code,close
0,2014-12-30,000001.XSHE,15.5
1,2014-12-31,000001.XSHE,15.84
2,2015-01-05,000001.XSHE,16.02
3,2015-01-06,000001.XSHE,15.78
4,2014-12-30,000002.XSHE,12.64
5,2014-12-31,000002.XSHE,13.9
6,2015-01-05,000002.XSHE,14.91
7,2015-01-06,000002.XSHE,14.36
tests/test_api.py