mirror of
https://github.com/python/cpython.git
synced 2025-10-04 22:20:46 +00:00
Merged revisions 77729 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r77729 | ezio.melotti | 2010-01-24 22:48:35 +0200 (Sun, 24 Jan 2010) | 1 line remove archaic functions from test_support ........
This commit is contained in:
parent
8b20c68503
commit
4bfd7ad09c
3 changed files with 42 additions and 69 deletions
|
@ -17,7 +17,7 @@ __all__ = ["Error", "TestFailed", "TestSkipped", "ResourceDenied", "import_modul
|
|||
"get_original_stdout", "unload", "unlink", "rmtree", "forget",
|
||||
"is_resource_enabled", "requires", "find_unused_port", "bind_port",
|
||||
"fcmp", "have_unicode", "is_jython", "TESTFN", "HOST", "FUZZ",
|
||||
"findfile", "verify", "vereq", "sortdict", "check_syntax_error",
|
||||
"findfile", "sortdict", "check_syntax_error",
|
||||
"open_urlresource", "check_warnings", "CleanImport",
|
||||
"EnvironmentVarGuard", "captured_output",
|
||||
"captured_stdout", "TransientResource", "transient_internet",
|
||||
|
@ -325,30 +325,6 @@ def findfile(file, here=__file__):
|
|||
if os.path.exists(fn): return fn
|
||||
return file
|
||||
|
||||
def verify(condition, reason='test failed'):
|
||||
"""Verify that condition is true. If not, raise TestFailed.
|
||||
|
||||
The optional argument reason can be given to provide
|
||||
a better error text.
|
||||
"""
|
||||
|
||||
if not condition:
|
||||
raise TestFailed(reason)
|
||||
|
||||
def vereq(a, b):
|
||||
"""Raise TestFailed if a == b is false.
|
||||
|
||||
This is better than verify(a == b) because, in case of failure, the
|
||||
error message incorporates repr(a) and repr(b) so you can see the
|
||||
inputs.
|
||||
|
||||
Note that "not (a == b)" isn't necessarily the same as "a != b"; the
|
||||
former is tested.
|
||||
"""
|
||||
|
||||
if not (a == b):
|
||||
raise TestFailed("%r == %r" % (a, b))
|
||||
|
||||
def sortdict(dict):
|
||||
"Like repr(dict), but in sorted order."
|
||||
items = dict.items()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue