Skip to content

Commit

Permalink
Merge pull request #18 from ishanarora/issue/17
Browse files Browse the repository at this point in the history
Resolve #17
  • Loading branch information
hackebrot authored May 22, 2018
2 parents 66eb593 + b825ce8 commit 0ea00b9
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion poyo/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

_LIST_VALUE = (
_BLANK + r"-" + _BLANK +
r"('.*?'|\".*?\"|[^#]+?)" +
r"('.*?'|\".*?\"|[^#\n]+?)" +
_INLINE_COMMENT + _OPT_NEWLINE
)
_LIST_ITEM = _BLANK_LINE + r"|" + _COMMENT + r"|" + _LIST_VALUE
Expand Down
13 changes: 13 additions & 0 deletions tests/lists.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
a:
- 1
- 2 # comment between a and b
b:
- 3
- 4
c:
- 5
- 6
# comment between c and d
d:
- 7
- 8
23 changes: 23 additions & 0 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,26 @@ def test_parse_string_no_newline_list(string_data):
},
}
assert parse_string(string_data) == expected


@pytest.mark.parametrize('ymlfile', ['lists'])
def test_parse_string_lists(string_data):
expected = {
u'a': [
1,
2,
],
u'b': [
3,
4,
],
u'c': [
5,
6,
],
u'd': [
7,
8,
],
}
assert parse_string(string_data) == expected

0 comments on commit 0ea00b9

Please # to comment.