mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
PEP 417: Adding unittest.mock
This commit is contained in:
parent
8d8f110492
commit
345266aa7e
11 changed files with 6682 additions and 0 deletions
23
Lib/unittest/test/testmock/support.py
Normal file
23
Lib/unittest/test/testmock/support.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
import sys
|
||||
|
||||
def is_instance(obj, klass):
|
||||
"""Version of is_instance that doesn't access __class__"""
|
||||
return issubclass(type(obj), klass)
|
||||
|
||||
|
||||
class SomeClass(object):
|
||||
class_attribute = None
|
||||
|
||||
def wibble(self):
|
||||
pass
|
||||
|
||||
|
||||
class X(object):
|
||||
pass
|
||||
|
||||
|
||||
def examine_warnings(func):
|
||||
def wrapper():
|
||||
with catch_warnings(record=True) as ws:
|
||||
func(ws)
|
||||
return wrapper
|
Loading…
Add table
Add a link
Reference in a new issue