Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: tests/test_rpy.py

Issue 29880577: Issue 6877 - Only parse headers in the first line of the filter list (Closed)
Patch Set: Fix header parsing, improve argument naming and documentation Created Sept. 18, 2018, 6:06 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/test_parser.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/test_rpy.py
===================================================================
--- a/tests/test_rpy.py
+++ b/tests/test_rpy.py
@@ -28,16 +28,24 @@
_TEST_EXAMPLES = {
'header': {
'in': b'[Adblock Plus 2.0]',
'out': {
b'type': b'Header',
b'version': b'Adblock Plus 2.0',
},
},
+ 'metadata': {
+ 'in': b'! Title: Example list',
+ 'out': {
+ b'type': b'Metadata',
+ b'key': b'Title',
+ b'value': b'Example list',
+ },
+ },
'comment': {
'in': b'! Comment',
'out': {
b'type': b'Comment',
b'text': b'Comment',
},
},
'empty': {
@@ -130,11 +138,12 @@
@pytest.mark.parametrize('line_type', list(_TEST_EXAMPLES.keys()))
def test_line2dict_format(line_type):
"""Test that the API result has the appropriate format.
Checks for both keys and datatypes.
"""
- data = line2dict(_TEST_EXAMPLES[line_type]['in'])
+ position = 'start' if line_type in {'header', 'metadata'} else 'body'
+ data = line2dict(_TEST_EXAMPLES[line_type]['in'], position)
assert data == _TEST_EXAMPLES[line_type]['out']
« no previous file with comments | « tests/test_parser.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld