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'] |