diff options
author | Dawid Fatyga <dawid.fatyga@gmail.com> | 2012-04-24 23:41:02 +0200 |
---|---|---|
committer | Dawid Fatyga <dawid.fatyga@gmail.com> | 2012-04-24 23:41:02 +0200 |
commit | 64a3cb2446b664817329bac127da9fe91c7e54ee (patch) | |
tree | 76448754027c022206601f504c229aa87c702a6e /mox_test.py | |
parent | 79af932dab26a3c8ef31d840f94582b9b922855a (diff) | |
download | pymox-fix-callables-inconsistency.tar.gz |
Added test for changed semantics in Python 3.fix-callables-inconsistency
Diffstat (limited to 'mox_test.py')
-rwxr-xr-x | mox_test.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mox_test.py b/mox_test.py index 3d95f38..434ae51 100755 --- a/mox_test.py +++ b/mox_test.py @@ -23,6 +23,7 @@ import io import unittest import re +import sys import mox @@ -748,6 +749,21 @@ class MockAnythingTest(unittest.TestCase): class MethodCheckerTest(unittest.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, |