Skip to content

Commit

Permalink
Added tests for comment parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
buglloc committed May 2, 2017
1 parent 521d4e3 commit 5dfcd5e
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/parser/test_raw_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,35 @@ def test_file_delims():

assert_config(config, expected)


def test_comments():
config = '''
# Some comment
add_header X-Some-Comment some;
#
# Comment with padding
#
add_header X-Padding-Comment padding;
#
add_header X-Blank-Comment blank;
'''

expected = [
['Some comment'],
['add_header', 'X-Some-Comment', 'some'],
[''],
['Comment with padding'],
[''],
['add_header', 'X-Padding-Comment', 'padding'],
[''],
['add_header', 'X-Blank-Comment', 'blank'],
]

assert_config(config, expected)


def assert_config(config, expected):
with mock.patch('%s.open' % builtins.__name__) as mock_open:
mock_open.return_value = StringIO(config)
Expand Down

0 comments on commit 5dfcd5e

Please sign in to comment.