Commit 8769d4dd authored by Aurélien Campéas's avatar Aurélien Campéas
Browse files

test: prove that we can crash with some series editions

parent 4da65f230da7
......@@ -5,7 +5,7 @@ import pytest
import pandas as pd
import numpy as np
from tshistory.testutil import assert_structures
from tshistory.testutil import assert_structures, utcdt
from tshistory_supervision.tsio import TimeSerie
......@@ -47,6 +47,16 @@ def test_mercure_serie(engine, tsh):
""", pd.read_sql('select * from tsh.changeset_series', engine))
def test_non_monotonic_autodiff(engine, tsh):
s1 = pd.Series([1, 3], index=[utcdt(2018, 1, 1), utcdt(2018, 1, 3)])
s2 = pd.Series([2, 3.1], index=[utcdt(2018, 1, 2), utcdt(2018, 1, 3)])
tsh.insert(engine, s1, 'nmdiff', 'Babar')
with pytest.raises(AssertionError) as err:
tsh.insert(engine, s2, 'nmdiff', 'Celeste')
assert err.value.args[0] == 'The index is not monotonic'
def test_differential(engine, tsh):
ts_begin = genserie(datetime(2010, 1, 1), 'D', 10)
tsh.insert(engine, ts_begin, 'ts_test', 'test')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment