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

Side by Side Diff: tests/test_multi_source.py

Issue 29891645: Issue 5601 - Speed up static generation (Closed)
Patch Set: Created Sept. 25, 2018, 12:27 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
« cms/sources.py ('K') | « cms/sources.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 the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 assert not multi_source.has_file('d') 94 assert not multi_source.has_file('d')
95 95
96 96
97 def test_read_file(multi_source): 97 def test_read_file(multi_source):
98 assert multi_source.read_file('a') == ('b', 'foo:a') 98 assert multi_source.read_file('a') == ('b', 'foo:a')
99 assert multi_source.read_file('b') == ('b', 'bar:b') 99 assert multi_source.read_file('b') == ('b', 'bar:b')
100 assert multi_source.read_file('c') == ('d', 'foo:c') 100 assert multi_source.read_file('c') == ('d', 'foo:c')
101 101
102 102
103 def test_read_binary(multi_source): 103 def test_read_binary(multi_source):
104 assert isinstance(multi_source.read_file('a', binary=True)[0], type(b'b')) 104 assert isinstance(multi_source.read_file('a', True)[0], type(b'b'))
105 105
106 106
107 def test_list_files(multi_source): 107 def test_list_files(multi_source):
108 assert sorted(multi_source.list_files('')) == ['a', 'a/b/c', 'a/d', 'b', 108 assert sorted(multi_source.list_files('')) == ['a', 'a/b/c', 'a/d', 'b',
109 'c'] 109 'c']
110 assert sorted(multi_source.list_files('a')) == ['a/b/c', 'a/d'] 110 assert sorted(multi_source.list_files('a')) == ['a/b/c', 'a/d']
111 assert sorted(multi_source.list_files('a/')) == ['a/b/c', 'a/d'] 111 assert sorted(multi_source.list_files('a/')) == ['a/b/c', 'a/d']
112 112
113 113
114 def test_version(base_sources): 114 def test_version(base_sources):
115 assert MultiSource(base_sources).version == '42' 115 assert MultiSource(base_sources).version == '42'
116 with pytest.raises(AttributeError): 116 with pytest.raises(AttributeError):
117 MultiSource(list(reversed(base_sources))).version 117 MultiSource(list(reversed(base_sources))).version
118 118
119 119
120 def test_cache_dir(multi_source): 120 def test_cache_dir(multi_source):
121 assert multi_source.get_cache_dir() == 'cache' 121 assert multi_source.get_cache_dir() == 'cache'
OLDNEW
« cms/sources.py ('K') | « cms/sources.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld