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

Side by Side Diff: tests/test_xtm_translations_utils.py

Issue 29923555: Noissue - Switch to binary operator after line break standard following PEP8 and Flake8 (Closed) Base URL: https://hg.adblockplus.org/cms
Patch Set: Created Oct. 24, 2018, 2:02 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
« no previous file with comments | « tests/test_additional_paths.py ('k') | tox.ini » ('j') | tox.ini » ('J')
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 del os.environ[env_var] 75 del os.environ[env_var]
76 76
77 77
78 def test_sanitize_project_name_characters(): 78 def test_sanitize_project_name_characters():
79 """Test if invalid name characters are replaced as expected.""" 79 """Test if invalid name characters are replaced as expected."""
80 test_in = '{0}{1}{0}'.format( 80 test_in = '{0}{1}{0}'.format(
81 'test', ''.join(const.ProjectName.INVALID_CHARS), 81 'test', ''.join(const.ProjectName.INVALID_CHARS),
82 ) 82 )
83 exp_out = '{0}{1}{0}'.format( 83 exp_out = '{0}{1}{0}'.format(
84 'test', 84 'test',
85 const.ProjectName.NAME_WILDCARD * 85 const.ProjectName.NAME_WILDCARD * len(const.ProjectName.INVALID_CHARS),
86 len(const.ProjectName.INVALID_CHARS),
87 ) 86 )
88 87
89 assert exp_out == utils.sanitize_project_name(test_in) 88 assert exp_out == utils.sanitize_project_name(test_in)
90 89
91 90
92 def test_sanitize_project_name_length(): 91 def test_sanitize_project_name_length():
93 """Test if names that are too long are truncated as expected.""" 92 """Test if names that are too long are truncated as expected."""
94 test_in = 'a' * (const.ProjectName.MAX_LENGTH + 10) 93 test_in = 'a' * (const.ProjectName.MAX_LENGTH + 10)
95 exp_out = 'a' * const.ProjectName.MAX_LENGTH 94 exp_out = 'a' * const.ProjectName.MAX_LENGTH
96 95
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 221
223 assert toydir.join(path).read('rb') == data 222 assert toydir.join(path).read('rb') == data
224 223
225 224
226 def test_extract_unicode_strings(temp_site): 225 def test_extract_unicode_strings(temp_site):
227 """Test correct extraction of unicode strings for translation.""" 226 """Test correct extraction of unicode strings for translation."""
228 with FileSource(temp_site) as fs: 227 with FileSource(temp_site) as fs:
229 strings = utils.extract_strings(fs) 228 strings = utils.extract_strings(fs)
230 229
231 assert '\u0376' in strings['translate-unicode']['simple']['message'] 230 assert '\u0376' in strings['translate-unicode']['simple']['message']
OLDNEW
« no previous file with comments | « tests/test_additional_paths.py ('k') | tox.ini » ('j') | tox.ini » ('J')

Powered by Google App Engine
This is Rietveld