Use half-open intervals for time ranges

This commit is contained in:
Marko Durkovic
2021-07-04 22:27:52 +02:00
parent 5175c349aa
commit 12acb677e6
5 changed files with 12 additions and 12 deletions
+2 -2
View File
@@ -120,9 +120,9 @@ def bag(request: SubRequest, tmp_path: Path) -> Path:
def test_reader(bag: Path):
"""Test reader and deserializer on simple bag."""
with Reader(bag) as reader:
assert reader.duration == 42
assert reader.duration == 43
assert reader.start_time == 666
assert reader.end_time == 708
assert reader.end_time == 709
assert reader.message_count == 4
if reader.compression_mode:
assert reader.compression_format == 'zstd'
+4 -4
View File
@@ -198,9 +198,9 @@ def test_reader(tmp_path): # pylint: disable=too-many-statements
)
with Reader(bag) as reader:
assert reader.message_count == 1
assert reader.duration == 0
assert reader.duration == 1
assert reader.start_time == 42 * 10**9
assert reader.end_time == 42 * 10**9
assert reader.end_time == 42 * 10**9 + 1
assert len(reader.topics.keys()) == 1
assert reader.topics['/topic0'].msgcount == 1
msgs = list(reader.messages())
@@ -220,9 +220,9 @@ def test_reader(tmp_path): # pylint: disable=too-many-statements
)
with Reader(bag) as reader:
assert reader.message_count == 2
assert reader.duration == 5 * 10**9
assert reader.duration == 5 * 10**9 + 1
assert reader.start_time == 5 * 10**9
assert reader.end_time == 10 * 10**9
assert reader.end_time == 10 * 10**9 + 1
assert len(reader.topics.keys()) == 1
assert reader.topics['/topic0'].msgcount == 2
msgs = list(reader.messages())