Use current APIs
This commit is contained in:
parent
fa62876dd8
commit
54a7eca6be
@ -81,7 +81,7 @@ def test_failure_cases(tmp_path: Path):
|
|||||||
|
|
||||||
bag = Writer(tmp_path / 'write')
|
bag = Writer(tmp_path / 'write')
|
||||||
with pytest.raises(WriterError, match='was not opened'):
|
with pytest.raises(WriterError, match='was not opened'):
|
||||||
bag.write('/tf', 0, b'')
|
bag.write(Connection(1, 0, '/tf', 'tf_msgs/msg/tf2', 'cdr', ''), 0, b'')
|
||||||
|
|
||||||
bag = Writer(tmp_path / 'topic')
|
bag = Writer(tmp_path / 'topic')
|
||||||
bag.open()
|
bag.open()
|
||||||
|
|||||||
@ -84,16 +84,16 @@ def compare(path: Path):
|
|||||||
with Reader(path) as reader:
|
with Reader(path) as reader:
|
||||||
gens = (reader.messages(), ReaderPy(path).messages())
|
gens = (reader.messages(), ReaderPy(path).messages())
|
||||||
for item, item_py in zip(*gens):
|
for item, item_py in zip(*gens):
|
||||||
topic, msgtype, timestamp, data = item
|
connection, timestamp, data = item
|
||||||
topic_py, msgtype_py, timestamp_py, data_py = item_py
|
topic_py, msgtype_py, timestamp_py, data_py = item_py
|
||||||
|
|
||||||
assert topic == topic_py
|
assert connection.topic == topic_py
|
||||||
assert msgtype == msgtype_py
|
assert connection.msgtype == msgtype_py
|
||||||
assert timestamp == timestamp_py
|
assert timestamp == timestamp_py
|
||||||
assert data == data_py
|
assert data == data_py
|
||||||
|
|
||||||
msg_py = deserialize_py(data_py, msgtype_py)
|
msg_py = deserialize_py(data_py, msgtype_py)
|
||||||
msg = deserialize_cdr(data, msgtype)
|
msg = deserialize_cdr(data, connection.msgtype)
|
||||||
|
|
||||||
compare_msg(msg, msg_py)
|
compare_msg(msg, msg_py)
|
||||||
assert len(list(gens[0])) == 0
|
assert len(list(gens[0])) == 0
|
||||||
@ -118,8 +118,8 @@ def read_deser_rosbag2_py(path: Path):
|
|||||||
def read_deser_rosbag2(path: Path):
|
def read_deser_rosbag2(path: Path):
|
||||||
"""Read testbag with rosbag2lite."""
|
"""Read testbag with rosbag2lite."""
|
||||||
with Reader(path) as reader:
|
with Reader(path) as reader:
|
||||||
for _, msgtype, _, data in reader.messages():
|
for connection, _, data in reader.messages():
|
||||||
deserialize_cdr(data, msgtype)
|
deserialize_cdr(data, connection.msgtype)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user