Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/formatter/main_unittest.py

Issue 2580293002: Style change: Rename error variables "e" -> "error" (Closed)
Patch Set: Rebase and fix formatter unittest. Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import StringIO 5 import StringIO
6 import unittest 6 import unittest
7 7
8 from webkitpy.common.system.system_host_mock import MockSystemHost 8 from webkitpy.common.system.system_host_mock import MockSystemHost
9 from webkitpy.formatter.main import main 9 from webkitpy.formatter.main import main
10 10
11 11
12 ACTUAL_INPUT = ''' 12 ACTUAL_INPUT = '''
13 def foo(): 13 def foo():
14 """triple-quoted docstring""" 14 """triple-quoted docstring"""
15 try: 15 try:
16 bar = "bar" 16 bar = "bar"
17 long_list = ['this is a list of strings that should be wrapped', "and co nsistently quoted"] 17 long_list = ['this is a list of strings that should be wrapped', "and co nsistently quoted"]
18 longer_list = ['this is a list of strings that should be wrapped', "and consistently quoted", "because it's important to test quoting"] 18 longer_list = ['this is a list of strings that should be wrapped', "and consistently quoted", "because it's important to test quoting"]
19 except Exception, e: 19 except Exception, error:
20 pass 20 pass
21 ''' 21 '''
22 22
23 23
24 EXPECTED_BLINK_OUTPUT = ''' 24 EXPECTED_BLINK_OUTPUT = '''
25 def foo(): 25 def foo():
26 """triple-quoted docstring""" 26 """triple-quoted docstring"""
27 try: 27 try:
28 bar = 'bar' 28 bar = 'bar'
29 long_list = ['this is a list of strings that should be wrapped', 'and co nsistently quoted'] 29 long_list = ['this is a list of strings that should be wrapped', 'and co nsistently quoted']
30 longer_list = [ 30 longer_list = [
31 'this is a list of strings that should be wrapped', 31 'this is a list of strings that should be wrapped',
32 'and consistently quoted', 32 'and consistently quoted',
33 "because it's important to test quoting"] 33 "because it's important to test quoting"]
34 except Exception as e: 34 except Exception as error:
35 pass 35 pass
36 ''' 36 '''
37 37
38 38
39 EXPECTED_CHROMIUM_OUTPUT = ''' 39 EXPECTED_CHROMIUM_OUTPUT = '''
40 def foo(): 40 def foo():
41 """triple-quoted docstring""" 41 """triple-quoted docstring"""
42 try: 42 try:
43 bar = 'bar' 43 bar = 'bar'
44 long_list = [ 44 long_list = [
45 'this is a list of strings that should be wrapped', 45 'this is a list of strings that should be wrapped',
46 'and consistently quoted'] 46 'and consistently quoted']
47 longer_list = [ 47 longer_list = [
48 'this is a list of strings that should be wrapped', 48 'this is a list of strings that should be wrapped',
49 'and consistently quoted', 49 'and consistently quoted',
50 "because it's important to test quoting"] 50 "because it's important to test quoting"]
51 except Exception as e: 51 except Exception as error:
52 pass 52 pass
53 ''' 53 '''
54 54
55 EXPECTED_ONLY_DOUBLE_QUOTED_OUTPUT = ''' 55 EXPECTED_ONLY_DOUBLE_QUOTED_OUTPUT = '''
56 def foo(): 56 def foo():
57 """triple-quoted docstring""" 57 """triple-quoted docstring"""
58 try: 58 try:
59 bar = "bar" 59 bar = "bar"
60 long_list = ["this is a list of strings that should be wrapped", "and co nsistently quoted"] 60 long_list = ["this is a list of strings that should be wrapped", "and co nsistently quoted"]
61 longer_list = ["this is a list of strings that should be wrapped", "and consistently quoted", "because it's important to test quoting"] 61 longer_list = ["this is a list of strings that should be wrapped", "and consistently quoted", "because it's important to test quoting"]
62 except Exception, e: 62 except Exception, error:
63 pass 63 pass
64 ''' 64 '''
65 65
66 66
67 class TestMain(unittest.TestCase): 67 class TestMain(unittest.TestCase):
68 maxDiff = 4096 68 maxDiff = 4096
69 69
70 def test_files_blink(self): 70 def test_files_blink(self):
71 host = MockSystemHost() 71 host = MockSystemHost()
72 host.filesystem.files = { 72 host.filesystem.files = {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 """ 144 """
145 ''') 145 ''')
146 main(host, ['-']) 146 main(host, ['-'])
147 self.assertMultiLineEqual(host.stdout.getvalue(), ''' 147 self.assertMultiLineEqual(host.stdout.getvalue(), '''
148 def f(): 148 def f():
149 """This is a docstring 149 """This is a docstring
150 With extra indentation on this line. 150 With extra indentation on this line.
151 """ 151 """
152 ''') 152 ''')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698