fix(understand): a line number is not an equipment tag
parse_tag started a token at the first letter, so '100-P-001', a line number that begins with its size, read as the pump tag P-001. The review of the network engine found this. On a P&ID the phantom tag can capture a valve beside the line as equipment, or collide with the real pump P-001. A token that is the tail of a word beginning with a digit is no longer a tag. The same text still yields T101 in 'LINE 100-P-001 TO T101', and P-001 alone is still a tag. The new test failed before this change; the label, network, describe, scale, cable and plant-pair suites all pass (160 tests). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FKFStjEFzpGyLq5bMpWxTd
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
27d44e909e
commit
fb2953c324
@@ -163,6 +163,16 @@ def test_text_without_a_tag():
|
||||
assert parse_tag(None) is None
|
||||
|
||||
|
||||
def test_a_line_number_is_not_an_equipment_tag():
|
||||
# A line number starts with its size: read as a tag, '100-P-001' would give
|
||||
# 'P-001', which can capture a valve beside the line or collide with a real
|
||||
# pump P-001. A word that begins with a digit holds no tag.
|
||||
assert parse_tag("100-P-001") is None
|
||||
assert parse_tag('2"-P-1001-A1') is None
|
||||
assert parse_tag("LINE 100-P-001 TO T101") == "T101"
|
||||
assert parse_tag("P-001") == "P-001" # the pump itself is still a tag
|
||||
|
||||
|
||||
# -- panels and wiring callouts ----------------------------------------------------
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user