Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Mirroring fix in PR #370 for interpretations
Browse files Browse the repository at this point in the history
  • Loading branch information
gregoryfoster committed Apr 19, 2017
1 parent b0cc5fe commit 996a77b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion interpparser/amendments.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def content_for_interpretations(instruction_xml):
"""Return a chunk of XML (which serves as a unique key) and a think for
parsing that XML as an interpretation"""
label_parts, amdpar = label_amdpar_from(instruction_xml)
if len(label_parts) > 0 and 'Interpretations' in label_parts[1]:
if len(label_parts) > 1 and 'Interpretations' in label_parts[1]:
xml = amdpar.getparent()
return xml, functools.partial(parse_interp, label_parts[0], xml)

Expand Down
9 changes: 9 additions & 0 deletions tests/interpparser/amendments_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,12 @@ def test_process_amendments_restart_new_section(monkeypatch):

assert changes1['104-22-a-Interp'][0]['action'] == 'POST'
assert changes2['105-1-b'][0]['action'] == 'PUT'


def test_content_for_interpretations_regression_369():
"""Regression test for modifications to a top-level element"""
with XMLBuilder('EREGS_INSTRUCTIONS', final_context='2-?-201') as ctx:
ctx.POST(label='2[title]')
ctx.POST(label='2-?-200')
ctx.POST(label='2-?-201')
assert amendments.content_for_interpretations(ctx.xml) is None

0 comments on commit 996a77b

Please sign in to comment.