def test_order():
    df = pd.DataFrame( { 'PRODUCT_ID' : 1 , 'DATE' : pd.date_range('1/1/2011',periods=5, freq='D'), 'SALES' : [2,3,4,1,1],
                        })
    config = {'replenishment': {'quantiles': 70, 'replenishment': {'model': 'replenishment'},
                                'prediction': {'model': 'simple_prediction', 'window': 0}, 'input_file': 'temp.csv'}}
    result = ord.order(df,config)
    npt.assert_array_equal(df['ORDER'], [3,4,5,1,1])
    parser = argparse.ArgumentParser()
    parser.add_argument("-y", "--yaml", help="yaml inputfile to test", type=str)
    parser.add_argument("-d", "--orderday", help="date of order", type=str)
    parser.add_argument("-o", "--outputfile", help="name of outputfile", type=str)

    args = parser.parse_args()

    # parse config file
    rep_args = parse_yaml(args.yaml)

    test_file(rep_args, 'replenishment')

    start_time = time.time()
    '''
    read in file
    '''
    df = pd.read_csv(rep_args['replenishment']['input_file'],sep=';', parse_dates=['DATE'])
    orderday = datetime.datetime.strptime(args.orderday,'%Y-%m-%d')
    df = df[df['DATE']<=orderday]
    df = df.sort(['PRODUCT_ID','DATE'])
    df = df.reset_index()

    order_df = rep.order(df,rep_args)
    order_df = order_df[order_df['DATE']==orderday]

    end_time = time.time()

    print "--- %s seconds ---" % (end_time - start_time)

    order_df.to_csv(args.outputfile+'.csv', sep=';')