Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
aa515082
Commit
aa515082
authored
Sep 09, 2019
by
Xtreak
Committed by
Lisa Roach
Sep 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix assertions regarding magic methods function body that was not executed (GH-14154)
parent
526a0146
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
9 deletions
+2
-9
Lib/unittest/test/testmock/testasync.py
Lib/unittest/test/testmock/testasync.py
+2
-9
No files found.
Lib/unittest/test/testmock/testasync.py
View file @
aa515082
...
...
@@ -361,17 +361,14 @@ class AsyncArguments(unittest.TestCase):
class
AsyncContextManagerTest
(
unittest
.
TestCase
):
class
WithAsyncContextManager
:
def
__init__
(
self
):
self
.
entered
=
False
self
.
exited
=
False
async
def
__aenter__
(
self
,
*
args
,
**
kwargs
):
self
.
entered
=
True
return
self
async
def
__aexit__
(
self
,
*
args
,
**
kwargs
):
self
.
exited
=
True
pass
def
test_magic_methods_are_async_mocks
(
self
):
mock
=
MagicMock
(
self
.
WithAsyncContextManager
())
...
...
@@ -390,11 +387,7 @@ class AsyncContextManagerTest(unittest.TestCase):
return
result
result
=
asyncio
.
run
(
use_context_manager
())
self
.
assertFalse
(
instance
.
entered
)
self
.
assertFalse
(
instance
.
exited
)
self
.
assertTrue
(
called
)
self
.
assertTrue
(
mock_instance
.
entered
)
self
.
assertTrue
(
mock_instance
.
exited
)
self
.
assertTrue
(
mock_instance
.
__aenter__
.
called
)
self
.
assertTrue
(
mock_instance
.
__aexit__
.
called
)
self
.
assertIsNot
(
mock_instance
,
result
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment