def test_cumsum(): dt = mn.sum_money(rt.read_file('money')) # Assert at datapoint assert float(prg.transaction_at("2014-05-08", dt).total_value) == 4000.0 assert float(prg.transaction_at("2014-05-10", dt).total_value) == 5000.0 # Assert between datapoints (should get nearest smaller index) assert float(prg.transaction_at("2014-05-09", dt).total_value) == 4000.0
def test_transaction_at_missing_inter(): df = prg.to_dataframe(rt.read_file('transactions')) tr = prg.transaction_at("2014-04-09", df) field_by_field_equal(tr, example_dict_inter)
def test_transaction_at_direct(): df = prg.to_dataframe(rt.read_file('transactions')) tr = prg.transaction_at("2014-04-10", df) field_by_field_equal(tr, example_dict)