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

Side by Side Diff: testing_support/auto_stub.py

Issue 14602008: Rename assertEquals to assertEqual in auto_stub.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 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 inspect 5 import inspect
6 import unittest 6 import unittest
7 7
8 8
9 class OrderedDict(object): 9 class OrderedDict(object):
10 """Incomplete and inefficient implementation of collections.OrderedDict.""" 10 """Incomplete and inefficient implementation of collections.OrderedDict."""
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 56
57 class SimpleMock(object): 57 class SimpleMock(object):
58 """Really simple manual class mock.""" 58 """Really simple manual class mock."""
59 def __init__(self, unit_test): 59 def __init__(self, unit_test):
60 """Do not call __init__ if you want to use the global call list to detect 60 """Do not call __init__ if you want to use the global call list to detect
61 ordering across different instances. 61 ordering across different instances.
62 """ 62 """
63 self.calls = [] 63 self.calls = []
64 self.unit_test = unit_test 64 self.unit_test = unit_test
65 self.assertEquals = unit_test.assertEquals 65 self.assertEqual = unit_test.assertEqual
66 66
67 def pop_calls(self): 67 def pop_calls(self):
68 """Returns the list of calls up to date. 68 """Returns the list of calls up to date.
69 69
70 Good to do self.assertEquals(expected, mock.pop_calls()). 70 Good to do self.assertEqual(expected, mock.pop_calls()).
71 """ 71 """
72 calls = self.calls 72 calls = self.calls
73 self.calls = [] 73 self.calls = []
74 return calls 74 return calls
75 75
76 def check_calls(self, expected): 76 def check_calls(self, expected):
77 self.assertEquals(expected, self.pop_calls()) 77 self.assertEqual(expected, self.pop_calls())
78 78
79 def _register_call(self, *args, **kwargs): 79 def _register_call(self, *args, **kwargs):
80 """Registers the name of the caller function.""" 80 """Registers the name of the caller function."""
81 caller_name = kwargs.pop('caller_name', None) or inspect.stack()[1][3] 81 caller_name = kwargs.pop('caller_name', None) or inspect.stack()[1][3]
82 str_args = ', '.join(repr(arg) for arg in args) 82 str_args = ', '.join(repr(arg) for arg in args)
83 str_kwargs = ', '.join('%s=%r' % (k, v) for k, v in kwargs.iteritems()) 83 str_kwargs = ', '.join('%s=%r' % (k, v) for k, v in kwargs.iteritems())
84 self.calls.append('%s(%s)' % ( 84 self.calls.append('%s(%s)' % (
85 caller_name, ', '.join(filter(None, [str_args, str_kwargs])))) 85 caller_name, ', '.join(filter(None, [str_args, str_kwargs]))))
86 86
87 87
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 if hasattr(super(TestCase, self), 'assertIn'): 119 if hasattr(super(TestCase, self), 'assertIn'):
120 return super(TestCase, self).assertIn(expr1, expr2, msg) 120 return super(TestCase, self).assertIn(expr1, expr2, msg)
121 if expr1 not in expr2: 121 if expr1 not in expr2:
122 self.fail(msg or '%r not in %r' % (expr1, expr2)) 122 self.fail(msg or '%r not in %r' % (expr1, expr2))
123 123
124 def assertLess(self, a, b, msg=None): 124 def assertLess(self, a, b, msg=None):
125 if hasattr(super(TestCase, self), 'assertLess'): 125 if hasattr(super(TestCase, self), 'assertLess'):
126 return super(TestCase, self).assertLess(a, b, msg) 126 return super(TestCase, self).assertLess(a, b, msg)
127 if not a < b: 127 if not a < b:
128 self.fail(msg or '%r not less than %r' % (a, b)) 128 self.fail(msg or '%r not less than %r' % (a, b))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698