diff --git a/README.md b/README.md index 22cf48a5cca904bf43bb0efa37d300fb733db0fc..91fd2a3fa3d7877fca86b1bf18c26d4a997c51c9 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ Then copy your resulting wheel and install it via pip on the target system. `direct_bytes` for compatibility with `VarlenSeries`. It's value is ignored * more class constructors use explicit typing - faster tempsdb +* `TimeSeries.get_current_value` will correctly raise `ValueError` instead of returning None ## v0.5.4 diff --git a/setup.cfg b/setup.cfg index 826a120afd476f1af449656febf391ec3d64e7da..86e9c08c185b6dd490131cb1c3eefcb2a7465580 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ # coding: utf-8 [metadata] name = tempsdb -version = 0.6a4 +version = 0.6a5 long-description = file: README.md long-description-content-type = text/markdown; charset=UTF-8 license_files = LICENSE diff --git a/tempsdb/series.pyx b/tempsdb/series.pyx index d04ad3453974d1d07a1bafe2eeb20f7bed7bcae1..d0d9ca0309df7aa326e252c1abb378fce6d63863 100644 --- a/tempsdb/series.pyx +++ b/tempsdb/series.pyx @@ -48,6 +48,9 @@ cdef class TimeSeries: cdef: Iterator it = self.iterate_range(self.last_chunk.max_ts, self.last_chunk.max_ts) tuple tpl = it.next_item() + + if tpl is None: + raise ValueError('Series is empty!') try: return tpl finally: diff --git a/tests/test_series.py b/tests/test_series.py index 66f03136c0e9fe27fc1dede69ca6cafe495d9815..a7f192f62013666bf6edd8d2eb9bbb0e49e8e9fc 100644 --- a/tests/test_series.py +++ b/tests/test_series.py @@ -6,6 +6,9 @@ class TestSeries(unittest.TestCase): def test_write_series(self): from tempsdb.series import create_series series = create_series('test3', 'test3', 10, 4096) + + self.assertRaises(ValueError, series.get_current_value) + for i in range(8000): series.append(i, b'\x00'*10)