Skip to content

Commit

Permalink
backup
Browse files Browse the repository at this point in the history
  • Loading branch information
F-Bk committed Dec 2, 2024
1 parent dfae81b commit 96d9121
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/asammdf/gui/widgets/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,10 @@ def extract_bus_csv_logging_thread(
]
for dbc_name, found_ids in call_info["found_ids"].items():
for msg_id, msg_name in sorted(found_ids):
message.append(f"- 0x{msg_id:X} --> {msg_name} in <{dbc_name}>")

if isinstance(msg_id, str):
message.append(f"- 0x{msg_id:X} --> {msg_name} in <{dbc_name}>")
else:
message.append(f"- 0x{msg_id[0]:X} --> {msg_name} in <{dbc_name}>")
message += [
"",
"The following Bus IDs were in the MDF log file, but not matched in the DBC:",
Expand Down
31 changes: 31 additions & 0 deletions test/asammdf/gui/widgets/batch/test_BatchWidget_Tab_BusLogging.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import urllib.request
from zipfile import ZipFile

import pandas as pd
from PySide6 import QtCore, QtTest

from asammdf.blocks.utils import load_can_database
Expand Down Expand Up @@ -127,3 +128,33 @@ def test_extract_bus_btn(self):
self.assertEqual(max(timestamps_size), size_from_mdf)
self.assertEqual(min(timestamps_min), min_from_mdf)
self.assertEqual(max(timestamps_max), max_from_mdf)

def test_extract_bus_csv_btn_0(self):
"""
Returns
-------
"""
# Precondition
for file in Path(self.test_workspace).iterdir():
self.assertNotEqual(file.suffix, ".csv")
self.assertEqual(self.widget.output_info_bus.toPlainText(), "")

# Expected results
output_file = Path.with_suffix(self.mdf_path, f".bus_logging.mf4")

# Set Prefix
self.widget.prefix.setText(self.id().split(".")[-1])

# Get new mdf file
self.mouse_click_on_btn_with_progress(self.widget.extract_csv_btn)

# Event
self.mouse_click_on_btn_with_progress(self.widget.extract_bus_csv_btn)

csv_tables = {file: pd.read_csv(file) for file in Path(self.test_workspace).iterdir() if file.suffix == ".csv"}
with OpenMDF(output_file) as mdf_file:

print("ok")
x = 5

0 comments on commit 96d9121

Please sign in to comment.