Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/validators/_extremes.py: 80%
10 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:08 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:08 +0000
1"""Extremes."""
2# -*- coding: utf-8 -*-
4# standard
5from functools import total_ordering
6from typing import Any
9@total_ordering
10class AbsMax:
11 """An object that is greater than any other object (except itself).
13 Inspired by https://pypi.python.org/pypi/Extremes.
15 Examples:
16 >>> from sys import maxint
17 >>> AbsMax > AbsMin
18 # Output: True
19 >>> AbsMax > maxint
20 # Output: True
21 >>> AbsMax > 99999999999999999
22 # Output: True
24 > *New in version 0.2.0*.
25 """
27 def __ge__(self, other: Any):
28 """GreaterThanOrEqual."""
29 return other is not AbsMax
32@total_ordering
33class AbsMin:
34 """An object that is less than any other object (except itself).
36 Inspired by https://pypi.python.org/pypi/Extremes.
38 Examples:
39 >>> from sys import maxint
40 >>> AbsMin < -maxint
41 # Output: True
42 >>> AbsMin < None
43 # Output: True
44 >>> AbsMin < ''
45 # Output: True
47 > *New in version 0.2.0*.
48 """
50 def __le__(self, other: Any):
51 """LessThanOrEqual."""
52 return other is not AbsMin