summaryrefslogtreecommitdiffstats
path: root/Lib/test/support
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/support')
-rw-r--r--Lib/test/support/__init__.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index dbbbdb0..c82037e 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -113,6 +113,7 @@ __all__ = [
"run_with_locale", "swap_item",
"swap_attr", "Matcher", "set_memlimit", "SuppressCrashReport", "sortdict",
"run_with_tz", "PGO", "missing_compiler_executable", "fd_count",
+ "ALWAYS_EQ", "LARGEST", "SMALLEST"
]
class Error(Exception):
@@ -3103,6 +3104,41 @@ class FakePath:
return self.path
+class _ALWAYS_EQ:
+ """
+ Object that is equal to anything.
+ """
+ def __eq__(self, other):
+ return True
+ def __ne__(self, other):
+ return False
+
+ALWAYS_EQ = _ALWAYS_EQ()
+
+@functools.total_ordering
+class _LARGEST:
+ """
+ Object that is greater than anything (except itself).
+ """
+ def __eq__(self, other):
+ return isinstance(other, _LARGEST)
+ def __lt__(self, other):
+ return False
+
+LARGEST = _LARGEST()
+
+@functools.total_ordering
+class _SMALLEST:
+ """
+ Object that is less than anything (except itself).
+ """
+ def __eq__(self, other):
+ return isinstance(other, _SMALLEST)
+ def __gt__(self, other):
+ return False
+
+SMALLEST = _SMALLEST()
+
def maybe_get_event_loop_policy():
"""Return the global event loop policy if one is set, else return None."""
return asyncio.events._event_loop_policy