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

Side by Side Diff: tests/test_renderer.py

Issue 29933555: Noissue - fix coding style and adjust linting config (Closed) Base URL: https://hg.adblockplus.org/python-abp
Patch Set: Created Nov. 1, 2018, 11:21 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
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
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 src = MockSource(fl='[Adblock]\n%include src:inc%', inc='Included') 63 src = MockSource(fl='[Adblock]\n%include src:inc%', inc='Included')
64 got = render_str('src:fl', {'src': src}) 64 got = render_str('src:fl', {'src': src})
65 assert got.startswith(head + '! *** src:inc ***\nIncluded') 65 assert got.startswith(head + '! *** src:inc ***\nIncluded')
66 66
67 67
68 def test_include2(head): 68 def test_include2(head):
69 src1 = MockSource(fl='[Adblock]\n%include inc1%', 69 src1 = MockSource(fl='[Adblock]\n%include inc1%',
70 inc1='%include src2:inc2%') 70 inc1='%include src2:inc2%')
71 src2 = MockSource(inc2='%include inc3%', inc3='Included') 71 src2 = MockSource(inc2='%include inc3%', inc3='Included')
72 got = render_str('src1:fl', {'src1': src1, 'src2': src2}) 72 got = render_str('src1:fl', {'src1': src1, 'src2': src2})
73 expect = (head + 73 expect = (
74 '! *** inc1 ***\n! *** src2:inc2 ***\n! *** inc3 ***\nIncluded') 74 head + '! *** inc1 ***\n! *** src2:inc2 ***\n! *** inc3 ***\nIncluded'
75 )
75 assert got.startswith(expect) 76 assert got.startswith(expect)
76 77
77 78
78 def test_circular_includes(): 79 def test_circular_includes():
79 src = MockSource(fl='[Adblock]\n%include src:fl%') 80 src = MockSource(fl='[Adblock]\n%include src:fl%')
80 with pytest.raises(IncludeError): 81 with pytest.raises(IncludeError):
81 render_str('src:fl', {'src': src}) 82 render_str('src:fl', {'src': src})
82 83
83 84
84 def test_timestamp(gmtime): 85 def test_timestamp(gmtime):
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 def test_missing_header(): 118 def test_missing_header():
118 src = MockSource(fl='! No header') 119 src = MockSource(fl='! No header')
119 with pytest.raises(MissingHeader): 120 with pytest.raises(MissingHeader):
120 render_str('fl', {}, src) 121 render_str('fl', {}, src)
121 122
122 123
123 def test_remove_checksum(head): 124 def test_remove_checksum(head):
124 src = MockSource(fl='[Adblock]\n! Comment\n! Checksum: foo') 125 src = MockSource(fl='[Adblock]\n! Comment\n! Checksum: foo')
125 got = render_str('fl', {}, src) 126 got = render_str('fl', {}, src)
126 assert got == head + '! Comment' 127 assert got == head + '! Comment'
OLDNEW
« tests/test_diff_script.py ('K') | « tests/test_parser.py ('k') | tox.ini » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld