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

Side by Side Diff: tests/test_differ.py

Issue 29845767: Issue 6685 - Offer incremental filter list downloads (Closed) Base URL: https://hg.adblockplus.org/python-abp/
Patch Set: Use iterables instead of str, stop repeating code Created Aug. 20, 2018, 6:18 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
« abp/filters/renderer.py ('K') | « abp/filters/renderer.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
(Empty)
1 # This file is part of Adblock Plus <https://adblockplus.org/>,
2 # Copyright (C) 2006-present eyeo GmbH
3 #
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
6 # published by the Free Software Foundation.
7 #
8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
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/>.
15
16
17 from abp.filters.renderer import render_diff
18
19 BASE = '''[Adblock Plus 2.0]
20 ! Checksum: O6rd2aavziYFTXVIGAMimg
21 ! Version: 111
22 ! Diff-URL: https://easylist-downloads.adblockplus.org/easylist/diffs/111.txt
23 ! Diff-Expires: 1 hours
24 ! Title: EasyList
25 ! Last modified: 26 Jul 2018 02:10 UTC
26 ! Expires: 1 days (update frequency)
27 ! Homepage: https://easylist.to/
28 ! Licence: https://easylist.to/pages/licence.html
29 !
30 ! Please report any unblocked adverts or problems
31 ! in the forums (https://forums.lanik.us/)
32 ! or via e-mail (easylist.subscription@gmail.com).
33 !
34 !-----------------------General advert blocking filters-----------------------!
35 ! *** easylist:easylist/easylist_general_block.txt ***
36 test
37 &act=ads_
38 &ad.vid=$~xmlhttprequest
39 &ad_box_
40 '''
41
42 LATEST = '''[Adblock Plus 2.0]
43 ! Checksum: H6T/6rjr+cjtpbghFTBTng
44 ! Version: 123
45 ! Diff-URL: https://easylist-downloads.adblockplus.org/easylist/diffs/123.txt
46 ! Diff-Expires: 1 hours
47 ! Title: EasyList
48 ! Last modified: 26 Jul 2018 21:00 UTC
49 ! Homepage: https://easylist.to/
50 ! Licence: https://easylist.to/pages/licence.html
51 !
52 ! Please report any unblocked adverts or problems
53 ! in the forums (https://forums.lanik.us/)
54 ! or via e-mail (easylist.subscription@gmail.com).
55 !
56 !-----------------------General advert blocking filters-----------------------!
57 ! *** easylist:easylist/easylist_general_block.txt ***
58 &act=ads_
59 &ad_box_
60 &ad_channel=
61 test
Sebastian Noack 2018/08/21 19:42:46 Perhaps add a leading whitespace here, so that we
rhowell 2018/08/27 22:06:27 Done.
62 '''
63
64
65 EXPECTED = '''[Adblock Plus Diff]
66 ! Diff-URL: https://easylist-downloads.adblockplus.org/easylist/diffs/123.txt
67 ! Expires:
68 ! Version: 123
69 + &ad_channel=
70 - &ad.vid=$~xmlhttprequest
71 '''
72
73
74 def test_differ():
75 exp = set(EXPECTED.splitlines())
76 gen = set(render_diff(BASE.splitlines(), LATEST.splitlines()))
77 assert(gen == exp)
OLDNEW
« abp/filters/renderer.py ('K') | « abp/filters/renderer.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld