summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Niemeyer <gustavo@niemeyer.net>2010-06-20 12:49:20 -0300
committerGustavo Niemeyer <gustavo@niemeyer.net>2010-06-20 12:49:20 -0300
commitf7ee6d1b32656d7143b9b02ce1afe0f7fa56dde9 (patch)
tree29543dd47697326df8b111f17f267f2dae1228ca
parent16f4771d2442b0438e7b245662f9f66e66790d72 (diff)
downloadmocker-f7ee6d1b32656d7143b9b02ce1afe0f7fa56dde9.tar.gz
Use the more reliable expect() automatically with MockerTestCase.
-rw-r--r--mocker.py3
-rwxr-xr-xtest.py7
2 files changed, 7 insertions, 3 deletions
diff --git a/mocker.py b/mocker.py
index 9d8a2b6..6a030e0 100644
--- a/mocker.py
+++ b/mocker.py
@@ -134,8 +134,6 @@ class MockerTestCase(unittest.TestCase):
a few additional helper methods.
"""
- expect = expect
-
def __init__(self, methodName="runTest"):
# So here is the trick: we take the real test method, wrap it on
# a function that do the job we have to do, and insert it in the
@@ -184,6 +182,7 @@ class MockerTestCase(unittest.TestCase):
self.run = run_wrapper
self.mocker = Mocker()
+ self.expect = Expect(self.mocker)
self.__cleanup_funcs = []
self.__cleanup_paths = []
diff --git a/test.py b/test.py
index dc160b3..44f9efc 100755
--- a/test.py
+++ b/test.py
@@ -294,7 +294,12 @@ class MockerTestCaseTest(TestCase):
self.assertEquals(type(self.test.mocker), Mocker)
def test_has_expect(self):
- self.assertTrue(self.test.expect is expect)
+ self.assertTrue(issubclass(self.test.expect, expect))
+
+ def test_expect_works_with_non_mocks(self):
+ # We must be using the Expect helper for this to work at all:
+ obj = self.test.mocker.mock()
+ self.test.expect(iter(obj)).generate([1,2,3])
def test_attributes_are_the_same(self):
class MyTest(MockerTestCase):