Skip to content

Commit

Permalink
Update line parsing for equal sign in tag values - fix #39
Browse files Browse the repository at this point in the history
  • Loading branch information
emi80 committed Mar 8, 2016
1 parent 5958477 commit cd21202
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion indexfile/index.py
Expand Up @@ -133,7 +133,7 @@ def kws():
if value.endswith('"'):
append = False
else:
key, value = item.strip().split(sep)
key, value = item.strip().split(sep, 1)
if value.count('"')==1 and value.startswith('"'):
append = True
continue
Expand Down
8 changes: 8 additions & 0 deletions test/test_index.py
Expand Up @@ -591,3 +591,11 @@ def test_issue_38():
out = to_str(**line)
print out
assert out == '''SMPTHNTS="2 pieces, 9x6 & 10x9mm; myofibers pale compared to other heart specimen; BSS notes ""mislabeled solution"""; SMRDTTL=91315246; SMRIN=7; id=1;'''

def test_issue_39():
index = '''.\tid=1; SMPTHNTS="6 pieces mucosa=3; muscularis=1; only muscle useful"; SMRDTTL=91315246; SMRIN=7;'''
line = parse_line(index)
assert line['id'] == '1'
assert line['SMPTHNTS'] == '"6 pieces mucosa=3; muscularis=1; only muscle useful"'
assert line['SMRDTTL'] == '91315246'
assert line['SMRIN'] == '7'

0 comments on commit cd21202

Please sign in to comment.