Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lob_hlpr/hlpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ def extract_identifier_from_hexfile(hex_str: str):
segments = []
segment = bytearray()
segment_address = None
# Without a type 04 record the upper address bits are zero
extended_address = 0
for idx, line in enumerate(hex_str.split("\n")):
line = line.replace("\r", "")
if line == "":
Expand Down
10 changes: 10 additions & 0 deletions tests/test_lob_hlpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@ def test_extract_identifier_no_hexinfo():
hlp.extract_identifier_from_hexfile(hex_str)


def test_extract_identifier_without_extended_address():
"""Data records before any extended address record start at address 0."""
hex_str = "\n".join(
line for line in HEX_STRINGS[2].splitlines() if not line.startswith(":02000004")
)
assert hlp.extract_identifier_from_hexfile(hex_str) == [
"app-nrf9160-wmbus v0.23.6+hw3 TZ2 (Jan 27 2024 14:20:46)"
]


def test_log_print_passes(tmp_path, capsys):
"""Test log_print function with valid inputs."""
test_logger = logging.getLogger("test_logger")
Expand Down