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

Side by Side Diff: tests/test_rpy.py

Issue 29880555: Issue 6877 - Only parse headers in the first line of the filter list (Closed)
Patch Set: Created Sept. 14, 2018, 2:40 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/test_parser.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This file is part of Adblock Plus <https://adblockplus.org/>, 1 # This file is part of Adblock Plus <https://adblockplus.org/>,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details. 11 # GNU General Public License for more details.
12 # 12 #
13 # You should have received a copy of the GNU General Public License 13 # You should have received a copy of the GNU General Public License
14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
15 15
16 """Functional tests for testing rPython integration.""" 16 """Functional tests for testing rPython integration."""
17 from __future__ import unicode_literals 17 from __future__ import unicode_literals
18 18
19 from collections import namedtuple 19 from collections import namedtuple
20 import pytest 20 import pytest
21 import sys 21 import sys
22 22
23 from abp.filters.rpy import tuple2dict, line2dict 23 from abp.filters.rpy import tuple2dict, line2dict
24 24
25 25
26 _SAMPLE_TUPLE = namedtuple('tuple', 'foo,bar') 26 _SAMPLE_TUPLE = namedtuple('tuple', 'foo,bar')
27 27
28 _TEST_EXAMPLES = { 28 _TEST_EXAMPLES = {
29 'header': {
30 'in': b'[Adblock Plus 2.0]',
31 'out': {
32 b'type': b'Header',
33 b'version': b'Adblock Plus 2.0',
34 },
35 },
36 'comment': { 29 'comment': {
37 'in': b'! Comment', 30 'in': b'! Comment',
38 'out': { 31 'out': {
39 b'type': b'Comment', 32 b'type': b'Comment',
40 b'text': b'Comment', 33 b'text': b'Comment',
41 }, 34 },
42 }, 35 },
43 'empty': { 36 'empty': {
44 'in': b'', 37 'in': b'',
45 'out': { 38 'out': {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 124
132 @pytest.mark.parametrize('line_type', list(_TEST_EXAMPLES.keys())) 125 @pytest.mark.parametrize('line_type', list(_TEST_EXAMPLES.keys()))
133 def test_line2dict_format(line_type): 126 def test_line2dict_format(line_type):
134 """Test that the API result has the appropriate format. 127 """Test that the API result has the appropriate format.
135 128
136 Checks for both keys and datatypes. 129 Checks for both keys and datatypes.
137 """ 130 """
138 data = line2dict(_TEST_EXAMPLES[line_type]['in']) 131 data = line2dict(_TEST_EXAMPLES[line_type]['in'])
139 132
140 assert data == _TEST_EXAMPLES[line_type]['out'] 133 assert data == _TEST_EXAMPLES[line_type]['out']
OLDNEW
« 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