Commit 0d6e0ff9 authored by Aurélien Campéas's avatar Aurélien Campéas
Browse files

insert/validate: show the offending index types

parent e1caae44b387
......@@ -965,9 +965,10 @@ def test_dtype_mismatch(engine, tsh):
genserie(datetime(2015, 1, 1), 'D', 11),
'error1',
'test')
assert ('Type error when inserting error1, new type is float64, '
'type in base is object') == str(excinfo.value)
assert excinfo.value.args[0] == (
'Type error when inserting error1, '
'new type is float64, type in base is object'
)
tsh.insert(engine,
genserie(datetime(2015, 1, 1), 'D', 11),
......@@ -979,9 +980,20 @@ def test_dtype_mismatch(engine, tsh):
genserie(datetime(2015, 1, 1), 'D', 11).astype('str'),
'error2',
'test')
assert excinfo.value.args[0] == (
'Type error when inserting error2, '
'new type is object, type in base is float64'
)
assert ('Type error when inserting error2, new type is object, '
'type in base is float64') == str(excinfo.value)
with pytest.raises(Exception) as excinfo:
tsh.insert(engine,
genserie(utcdt(2015, 1, 1), 'D', 11),
'error2',
'test')
assert excinfo.value.args[0] == (
'Incompatible index types: '
'ref=`datetime64[ns]`, new=`datetime64[ns, UTC]`'
)
def test_precision(engine, tsh):
......
......@@ -722,7 +722,10 @@ class timeseries(SeriesServices):
f'new type is {tstype}, type in base is {meta["value_type"]}')
raise Exception(m)
if ts.index.dtype.name != meta['index_type']:
raise Exception('Incompatible index types')
raise Exception(
'Incompatible index types: '
f'ref=`{meta["index_type"]}`, new=`{ts.index.dtype.name}`'
)
def _name_to_regid(self, cn, seriename):
regid = self.registry_map.get(seriename)
......
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