diff options
| author | Michael Foord <michael@voidspace.org.uk> | 2012-03-14 14:40:22 -0700 |
|---|---|---|
| committer | Michael Foord <michael@voidspace.org.uk> | 2012-03-14 14:40:22 -0700 |
| commit | a74b3aa0cce004bfa8a8be04519667a70d5651b0 (patch) | |
| tree | a4dfed6da54b06136388a4047f63cdfbc39884c4 /Lib/unittest/test | |
| parent | e7c8fdee18494238cc93eb895001398ceb7d12fb (diff) | |
| download | cpython-git-a74b3aa0cce004bfa8a8be04519667a70d5651b0.tar.gz | |
Remove more Python 2 compatibility cruft from unittest.mock
Diffstat (limited to 'Lib/unittest/test')
| -rw-r--r-- | Lib/unittest/test/testmock/testcallable.py | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/Lib/unittest/test/testmock/testcallable.py b/Lib/unittest/test/testmock/testcallable.py index bdc42fa4cc..7b2dd003ea 100644 --- a/Lib/unittest/test/testmock/testcallable.py +++ b/Lib/unittest/test/testmock/testcallable.py @@ -107,19 +107,9 @@ class TestCallable(unittest.TestCase): class Multi(SomeClass, Sub): pass - class OldStyle: - def __call__(self): - pass - - class OldStyleSub(OldStyle): - pass - for arg in 'spec', 'spec_set': - for Klass in CallableX, Sub, Multi, OldStyle, OldStyleSub: - patcher = patch('%s.X' % __name__, **{arg: Klass}) - mock = patcher.start() - - try: + for Klass in CallableX, Sub, Multi: + with patch('%s.X' % __name__, **{arg: Klass}) as mock: instance = mock() mock.assert_called_once_with() @@ -136,8 +126,6 @@ class TestCallable(unittest.TestCase): result.assert_called_once_with(3, 2, 1) result.foo(3, 2, 1) result.foo.assert_called_once_with(3, 2, 1) - finally: - patcher.stop() def test_create_autopsec(self): |
