REDROOM
PHP 8.5.2
Path:
Logout
Edit File
Size: 2.44 KB
Close
//lib/python3/dist-packages/hyperlink/test/common.py
Text
Base64
from typing import Any, Callable, Optional, Type from unittest import TestCase class HyperlinkTestCase(TestCase): """This type mostly exists to provide a backwards-compatible assertRaises method for Python 2.6 testing. """ def assertRaises( # type: ignore[override] self, expected_exception, # type: Type[BaseException] callableObj=None, # type: Optional[Callable[..., Any]] *args, # type: Any **kwargs # type: Any ): # type: (...) -> Any """Fail unless an exception of class expected_exception is raised by callableObj when invoked with arguments args and keyword arguments kwargs. If a different type of exception is raised, it will not be caught, and the test case will be deemed to have suffered an error, exactly as for an unexpected exception. If called with callableObj omitted or None, will return a context object used like this:: with self.assertRaises(SomeException): do_something() The context manager keeps a reference to the exception as the 'exception' attribute. This allows you to inspect the exception after the assertion:: with self.assertRaises(SomeException) as cm: do_something() the_exception = cm.exception self.assertEqual(the_exception.error_code, 3) """ context = _AssertRaisesContext(expected_exception, self) if callableObj is None: return context with context: callableObj(*args, **kwargs) class _AssertRaisesContext(object): "A context manager used to implement HyperlinkTestCase.assertRaises." def __init__(self, expected, test_case): # type: (Type[BaseException], TestCase) -> None self.expected = expected self.failureException = test_case.failureException def __enter__(self): # type: () -> "_AssertRaisesContext" return self def __exit__(self, exc_type, exc_value, tb): # type: (Optional[Type[BaseException]], Any, Any) -> bool if exc_type is None: exc_name = self.expected.__name__ raise self.failureException("%s not raised" % (exc_name,)) if not issubclass(exc_type, self.expected): # let unexpected exceptions pass through return False self.exception = exc_value # store for later retrieval return True
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 9
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
__pycache__
DIR
-
drwxr-xr-x
2026-01-08 12:56:13
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
common.py
2.44 KB
lrw-r--r--
2021-01-08 05:36:07
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
test_common.py
3.59 KB
lrw-r--r--
2021-01-08 05:36:07
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
test_decoded_url.py
6.96 KB
lrw-r--r--
2021-01-08 05:36:07
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
test_hypothesis.py
7.23 KB
lrw-r--r--
2020-08-04 06:14:29
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
test_parse.py
1.08 KB
lrw-r--r--
2020-08-04 06:14:29
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
test_scheme_registration.py
2.97 KB
lrw-r--r--
2021-01-08 05:36:07
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
test_socket.py
1.39 KB
lrw-r--r--
2020-01-21 00:44:35
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
test_url.py
53.31 KB
lrw-r--r--
2021-01-08 05:36:07
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__init__.py
601 B
lrw-r--r--
2020-08-04 06:14:29
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).