Fixes: MF4 Import Error (#23659)

* fix: asammdf and avro import error

* fix: mf4 import only

* test: fix mf4 test
This commit is contained in:
Keshav Mohta 2025-10-01 20:08:45 +05:30 committed by GitHub
parent 27380884eb
commit 48ff77c917
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -16,7 +16,6 @@ MF4 DataFrame reader for processing MF4 (Measurement Data Format) files
import io import io
import pandas as pd import pandas as pd
from asammdf import MDF
from metadata.readers.dataframe.base import DataFrameReader from metadata.readers.dataframe.base import DataFrameReader
from metadata.readers.dataframe.common import dataframe_to_chunks from metadata.readers.dataframe.common import dataframe_to_chunks
@ -38,6 +37,7 @@ class MF4DataFrameReader(DataFrameReader):
Extract schema from MF4 header common properties. Extract schema from MF4 header common properties.
This method uses the MDF header metadata instead of actual data extraction. This method uses the MDF header metadata instead of actual data extraction.
""" """
from asammdf import MDF
file_obj = io.BytesIO(mf4_bytes) file_obj = io.BytesIO(mf4_bytes)

View File

@ -58,7 +58,7 @@ class TestMF4DataFrameReader(TestCase):
} }
# Create mock MDF object with header # Create mock MDF object with header
with patch("metadata.readers.dataframe.mf4.MDF") as mock_mdf_class: with patch("asammdf.MDF") as mock_mdf_class:
mock_mdf = MagicMock() mock_mdf = MagicMock()
mock_header = MagicMock() mock_header = MagicMock()
mock_header._common_properties = expected_common_props mock_header._common_properties = expected_common_props
@ -78,7 +78,7 @@ class TestMF4DataFrameReader(TestCase):
""" """
mock_mf4_bytes = b"mock_mf4_content" mock_mf4_bytes = b"mock_mf4_content"
with patch("metadata.readers.dataframe.mf4.MDF") as mock_mdf_class: with patch("asammdf.MDF") as mock_mdf_class:
mock_mdf = MagicMock() mock_mdf = MagicMock()
mock_header = MagicMock() mock_header = MagicMock()
# No _common_properties attribute # No _common_properties attribute