Fix various pep8 issues
There weren't called before because test-requirements hardcoded an older version that is not what flake8 expected. Change-Id: I43b0c9f89d8411ae536ffd0540ff7ba47df46dda
This commit is contained in:
parent
dc010f3e24
commit
391d7c38f5
@ -911,8 +911,8 @@ class MethodSignatureChecker(object):
|
|||||||
raise ValueError('Could not get argument specification for %r'
|
raise ValueError('Could not get argument specification for %r'
|
||||||
% (method,))
|
% (method,))
|
||||||
if (inspect.ismethod(method) or class_to_bind or (
|
if (inspect.ismethod(method) or class_to_bind or (
|
||||||
hasattr(self, '_args') and len(self._args) > 0
|
hasattr(self, '_args') and len(self._args) > 0 and
|
||||||
and self._args[0] == 'self')):
|
self._args[0] == 'self')):
|
||||||
self._args = self._args[1:] # Skip 'self'.
|
self._args = self._args[1:] # Skip 'self'.
|
||||||
self._method = method
|
self._method = method
|
||||||
self._instance = None # May contain the instance this is bound to.
|
self._instance = None # May contain the instance this is bound to.
|
||||||
|
@ -90,8 +90,8 @@ class StubOutForTesting(object):
|
|||||||
# Calling getattr() on a staticmethod transforms it to a 'normal'
|
# Calling getattr() on a staticmethod transforms it to a 'normal'
|
||||||
# function. We need to ensure that we put it back as a staticmethod.
|
# function. We need to ensure that we put it back as a staticmethod.
|
||||||
old_attribute = obj.__dict__.get(attr_name)
|
old_attribute = obj.__dict__.get(attr_name)
|
||||||
if (old_attribute is not None
|
if (old_attribute is not None and
|
||||||
and isinstance(old_attribute, staticmethod)):
|
isinstance(old_attribute, staticmethod)):
|
||||||
orig_attr = staticmethod(orig_attr)
|
orig_attr = staticmethod(orig_attr)
|
||||||
|
|
||||||
self.stubs.append((orig_obj, attr_name, orig_attr))
|
self.stubs.append((orig_obj, attr_name, orig_attr))
|
||||||
|
@ -110,8 +110,12 @@ class FuncTest(testtools.TestCase):
|
|||||||
|
|
||||||
def testFuncTrueFalseEvaluation(self):
|
def testFuncTrueFalseEvaluation(self):
|
||||||
"""Should return True if the validating function returns True."""
|
"""Should return True if the validating function returns True."""
|
||||||
equals_one = lambda x: x == 1
|
|
||||||
always_none = lambda x: None
|
def equals_one(x):
|
||||||
|
return x == 1
|
||||||
|
|
||||||
|
def always_none(x):
|
||||||
|
return None
|
||||||
|
|
||||||
self.assertTrue(mox.Func(equals_one) == 1)
|
self.assertTrue(mox.Func(equals_one) == 1)
|
||||||
self.assertFalse(mox.Func(equals_one) == 0)
|
self.assertFalse(mox.Func(equals_one) == 0)
|
||||||
@ -210,8 +214,8 @@ class ContainsAttributeValueTest(testtools.TestCase):
|
|||||||
|
|
||||||
def testValidPair(self):
|
def testValidPair(self):
|
||||||
"""Return True if the object has the key attribute that matches."""
|
"""Return True if the object has the key attribute that matches."""
|
||||||
self.assertTrue(mox.ContainsAttributeValue("key", 1)
|
self.assertTrue(mox.ContainsAttributeValue("key", 1) ==
|
||||||
== self.test_object)
|
self.test_object)
|
||||||
|
|
||||||
def testInvalidValue(self):
|
def testInvalidValue(self):
|
||||||
"""Should return False if the value is not correct."""
|
"""Should return False if the value is not correct."""
|
||||||
@ -1257,8 +1261,8 @@ class MockObjectTest(testtools.TestCase):
|
|||||||
# NOT doing dummy[index]
|
# NOT doing dummy[index]
|
||||||
|
|
||||||
dummy._Replay()
|
dummy._Replay()
|
||||||
function = lambda: [x for x in dummy]
|
self.assertRaises(mox.UnexpectedMethodCallError,
|
||||||
self.assertRaises(mox.UnexpectedMethodCallError, function)
|
lambda: [x for x in dummy])
|
||||||
|
|
||||||
def testMockGetIter_WithSubClassOfNewStyleClass(self):
|
def testMockGetIter_WithSubClassOfNewStyleClass(self):
|
||||||
class NewStyleTestClass(object):
|
class NewStyleTestClass(object):
|
||||||
|
Loading…
Reference in New Issue
Block a user