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

Delta Between Two Patch Sets: tests/test_rpy.py

Issue 29849585: Issue 6835 - Add R support to python-abp (Closed)
Left Patch Set: Refactored tests Created Aug. 9, 2018, 12:53 p.m.
Right Patch Set: Fixed consistency issues in README.md Created Aug. 31, 2018, 10:17 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « abp/filters/rpy.py ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 """Test that dicts are produced correctly from a named tuple.""" 119 """Test that dicts are produced correctly from a named tuple."""
120 data = _SAMPLE_TUPLE(foo=foo, bar=bar) 120 data = _SAMPLE_TUPLE(foo=foo, bar=bar)
121 exp = {'foo': foo, 'bar': bar, 'type': 'tuple'} 121 exp = {'foo': foo, 'bar': bar, 'type': 'tuple'}
122 122
123 result = tuple2dict(data) 123 result = tuple2dict(data)
124 124
125 assert exp == result 125 assert exp == result
126 126
127 127
128 @pytest.mark.skipif(sys.version.startswith('3.'), reason='Redundant on py3+.') 128 @pytest.mark.skipif(sys.version.startswith('3.'), reason='Redundant on py3+.')
129 @pytest.mark.parametrize('line_type', list(_TEST_EXAMPLES.keys())) 129 @pytest.mark.parametrize('line_type', _TEST_EXAMPLES.keys())
Vasily Kuznetsov 2018/08/16 16:00:52 Do we need the `list(...)` here? If yes, never min
130 def test_line2dict_encoding(line_type): 130 def test_line2dict_encoding(line_type):
131 """Test that the resulting object has all strings encoded as utf-8. 131 """Test that the resulting object has all strings encoded as utf-8.
132 132
133 These tests will only be run on Python2.*. On Python3.*, these test 133 These tests will only be run on Python2.*. On Python3.*, these test
134 cases are covered by test_line2dict() below. 134 cases are covered by test_line2dict() below.
135 """ 135 """
136 data = line2dict(_TEST_EXAMPLES[line_type]['in']) 136 data = line2dict(_TEST_EXAMPLES[line_type]['in'])
137 check_data_utf8(data) 137 check_data_utf8(data)
138 138
139 139
140 @pytest.mark.parametrize('line_type', list(_TEST_EXAMPLES.keys())) 140 @pytest.mark.parametrize('line_type', list(_TEST_EXAMPLES.keys()))
141 def test_line2dict_format(line_type): 141 def test_line2dict_format(line_type):
142 """Test that the API result has the appropriate format. 142 """Test that the API result has the appropriate format.
143 143
144 Checks for both keys and datatypes. 144 Checks for both keys and datatypes.
145 """ 145 """
146 data = line2dict(_TEST_EXAMPLES[line_type]['in']) 146 data = line2dict(_TEST_EXAMPLES[line_type]['in'])
147 147
148 assert data == _TEST_EXAMPLES[line_type]['out'] 148 assert data == _TEST_EXAMPLES[line_type]['out']
LEFTRIGHT

Powered by Google App Engine
This is Rietveld