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

Side by Side Diff: tests/test_differ.py

Issue 29884571: Issue 6945 - Add script to make filter list diffs (Closed) Base URL: https://hg.adblockplus.org/python-abp/
Patch Set: Handle non-ascii, remove extraneous test Created Sept. 21, 2018, 8:33 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« abp/filters/diff_script.py ('K') | « tests/test_diff_script.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 16
17 from __future__ import unicode_literals
Sebastian Noack 2018/09/21 11:51:21 Nit: It seems in all other files we only have one
rhowell 2018/09/24 22:05:21 Done.
18
17 from abp.filters.renderer import render_diff 19 from abp.filters.renderer import render_diff
18 20
19 BASE = '''[Adblock Plus 2.0] 21 BASE = '''[Adblock Plus 2.0]
20 ! Version: 111 22 ! Version: 111
21 ! diff-url: https://easylist-downloads.adblockplus.org/easylist/diffs/111.txt 23 ! diff-url: https://easylist-downloads.adblockplus.org/easylist/diffs/111.txt
22 ! diff-expires: 1 hours 24 ! diff-expires: 1 hours
23 ! Title: EasyList 25 ! Title: EasyList
24 ! Expires: 1 days (update frequency) 26 ! Expires: 1 days (update frequency)
25 ! Homepage: https://easylist.to/ 27 ! Homepage: https://easylist.to/
26 ! Licence: https://easylist.to/pages/licence.html 28 ! Licence: https://easylist.to/pages/licence.html
(...skipping 19 matching lines...) Expand all
46 ! Licence: https://easylist.to/pages/licence.html 48 ! Licence: https://easylist.to/pages/licence.html
47 ! 49 !
48 ! Please report any unblocked adverts or problems 50 ! Please report any unblocked adverts or problems
49 ! in the forums (https://forums.lanik.us/) 51 ! in the forums (https://forums.lanik.us/)
50 ! or via e-mail (easylist.subscription@gmail.com). 52 ! or via e-mail (easylist.subscription@gmail.com).
51 ! 53 !
52 !-----------------------General advert blocking filters-----------------------! 54 !-----------------------General advert blocking filters-----------------------!
53 ! *** easylist:easylist/easylist_general_block.txt *** 55 ! *** easylist:easylist/easylist_general_block.txt ***
54 &act=ads_ 56 &act=ads_
55 &ad_box_ 57 &ad_box_
56 &ad_channel= 58 &ad_channel=\U000000a3
57 test 59 test
58 ''' 60 '''
59 61
60 62
61 EXPECTED = '''[Adblock Plus Diff] 63 EXPECTED = '''[Adblock Plus Diff]
62 ! Diff-URL: https://easylist-downloads.adblockplus.org/easylist/diffs/123.txt 64 ! Diff-URL: https://easylist-downloads.adblockplus.org/easylist/diffs/123.txt
63 ! Expires: 65 ! Expires:
64 ! Version: 123 66 ! Version: 123
65 - &ad.vid=$~xmlhttprequest 67 - &ad.vid=$~xmlhttprequest
66 + &ad_channel= 68 + &ad_channel=\U000000a3
67 ''' 69 '''
68 70
69 71
70 def test_differ(): 72 def test_differ():
71 exp = set(EXPECTED.splitlines()) 73 exp = set(EXPECTED.splitlines())
72 gen = set(render_diff(BASE.splitlines(), LATEST.splitlines())) 74 gen = set(render_diff(BASE.splitlines(), LATEST.splitlines()))
73 assert(gen == exp) 75 assert(gen == exp)
OLDNEW
« abp/filters/diff_script.py ('K') | « tests/test_diff_script.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld