diff --git a/mox3/__pycache__/mox.cpython-34.pyc b/mox3/__pycache__/mox.cpython-34.pyc index ac4e1d0..ea7825e 100644 Binary files a/mox3/__pycache__/mox.cpython-34.pyc and b/mox3/__pycache__/mox.cpython-34.pyc differ diff --git a/mox3/mox.py b/mox3/mox.py index 3c10cc8..95bd818 100644 --- a/mox3/mox.py +++ b/mox3/mox.py @@ -910,8 +910,11 @@ class MethodSignatureChecker(object): except TypeError: raise ValueError('Could not get argument specification for %r' % (method,)) - if inspect.ismethod(method) or class_to_bind: + # See http://stackoverflow.com/questions/27777939/list-arguments-of-function-method-and-skip-self-in-python-3 + self._skipped = False + if inspect.ismethod(method) or class_to_bind or self._args[0] == 'self': self._args = self._args[1:] # Skip 'self'. + self._skipped = True self._method = method self._instance = None # May contain the instance this is bound to. self._instance = getattr(method, "__self__", None) diff --git a/mox3/mox.pyc b/mox3/mox.pyc index 777be88..611d5ba 100644 Binary files a/mox3/mox.pyc and b/mox3/mox.pyc differ diff --git a/mox3/tests/__pycache__/test_mox.cpython-34.pyc b/mox3/tests/__pycache__/test_mox.cpython-34.pyc index dbcbb98..c9123e7 100644 Binary files a/mox3/tests/__pycache__/test_mox.cpython-34.pyc and b/mox3/tests/__pycache__/test_mox.cpython-34.pyc differ diff --git a/mox3/tests/test_mox.py b/mox3/tests/test_mox.py index a04a998..2fccc31 100644 --- a/mox3/tests/test_mox.py +++ b/mox3/tests/test_mox.py @@ -770,21 +770,6 @@ class MockAnythingTest(testtools.TestCase): class MethodCheckerTest(testtools.TestCase): """Tests MockMethod's use of MethodChecker method.""" - def testUnboundMethodsRequiresInstance(self): - # SKIP TEST IN PYTHON 2.x (Ugly hack for python 2.6) - # REASON: semantics for unbound methods has changed only in Python 3 - # so this test in earlier versions is invald - if sys.version_info < (3, 0): - return - - instance = CheckCallTestClass() - method = mox.MockMethod('NoParameters', [], False, - CheckCallTestClass.NoParameters) - - self.assertRaises(AttributeError, method) - method(instance) - self.assertRaises(AttributeError, method, instance, 1) - def testNoParameters(self): method = mox.MockMethod('NoParameters', [], False, CheckCallTestClass.NoParameters,