summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Foord <michael@voidspace.org.uk>2012-04-13 17:39:31 +0100
committerMichael Foord <michael@voidspace.org.uk>2012-04-13 17:39:31 +0100
commit356f852886bfc519e9ad291df6b8fd9aa8c861cd (patch)
tree918592d47d1f0718aefd95f0873f2d96e24b3f4d
parent7e44aecbd98ce6e4718c81a12418505c2172fcc7 (diff)
downloadmock-356f852886bfc519e9ad291df6b8fd9aa8c861cd.tar.gz
Move test and update code comment
-rw-r--r--mock.py3
-rw-r--r--tests/testhelpers.py30
2 files changed, 17 insertions, 16 deletions
diff --git a/mock.py b/mock.py
index e69a65c..a93b032 100644
--- a/mock.py
+++ b/mock.py
@@ -2163,7 +2163,8 @@ def create_autospec(spec, spec_set=False, instance=False, _parent=None,
# object to mock it so we would rather trigger a property than mock
# the property descriptor. Likewise we want to mock out dynamically
# provided attributes.
- # XXXX what about attributes that raise exceptions on being fetched
+ # XXXX what about attributes that raise exceptions other than
+ # AttributeError on being fetched?
# we could be resilient against it, or catch and propagate the
# exception when the attribute is fetched from the mock
try:
diff --git a/tests/testhelpers.py b/tests/testhelpers.py
index 6a7d68b..aa59e99 100644
--- a/tests/testhelpers.py
+++ b/tests/testhelpers.py
@@ -676,21 +676,6 @@ class SpecSignatureTest(unittest2.TestCase):
mock.f.assert_called_with(3, 4)
- def test_signature_class(self):
- class Foo(object):
- def __init__(self, a, b=3):
- pass
-
- mock = create_autospec(Foo)
-
- self.assertRaises(TypeError, mock)
- mock(1)
- mock.assert_called_once_with(1)
-
- mock(4, 5)
- mock.assert_called_with(4, 5)
-
-
def test_skip_attributeerrors(self):
class Raiser(object):
def __get__(self, obj, type=None):
@@ -714,6 +699,21 @@ class SpecSignatureTest(unittest2.TestCase):
obj.foo, obj.bar
+ def test_signature_class(self):
+ class Foo(object):
+ def __init__(self, a, b=3):
+ pass
+
+ mock = create_autospec(Foo)
+
+ self.assertRaises(TypeError, mock)
+ mock(1)
+ mock.assert_called_once_with(1)
+
+ mock(4, 5)
+ mock.assert_called_with(4, 5)
+
+
@unittest2.skipIf(inPy3k, 'no old style classes in Python 3')
def test_signature_old_style_class(self):
class Foo: