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 @@ -260,6 +260,8 @@ def parse_dmc(dmc):
# This: MPP-M0011554-OR019504_1-00781
article_number = chunks.pop(1)
# Changes to MPP-OR019504_1-00781
if chunks[0] != "MPP":
raise ValueError(f"Invalid DMC format: {dmc}, must start with MPP")
# We want the OR019504 part
erp_prod_number = chunks[0] + "-" + re.split("_", chunks[1])[0]

Expand Down
2 changes: 2 additions & 0 deletions tests/test_lob_hlpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def test_parse_dmc_fail():
"""Test failing branches of the parse_dmc function."""
with pytest.raises(IndexError):
hlp.parse_dmc("MPP-OR023282_1")
with pytest.raises(ValueError):
hlp.parse_dmc("PP-OR023282_1")


# A bit of looking through a hex file and manual parsing allows me to provide
Expand Down