Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/validators/_extremes.py: 80%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

10 statements  

1"""Extremes.""" 

2 

3# standard 

4from functools import total_ordering 

5from typing import Any 

6 

7 

8@total_ordering 

9class AbsMax: 

10 """An object that is greater than any other object (except itself). 

11 

12 Inspired by https://pypi.python.org/pypi/Extremes. 

13 

14 Examples: 

15 >>> from sys import maxint 

16 >>> AbsMax > AbsMin 

17 # Output: True 

18 >>> AbsMax > maxint 

19 # Output: True 

20 >>> AbsMax > 99999999999999999 

21 # Output: True 

22 """ 

23 

24 def __ge__(self, other: Any): 

25 """GreaterThanOrEqual.""" 

26 return other is not AbsMax 

27 

28 

29@total_ordering 

30class AbsMin: 

31 """An object that is less than any other object (except itself). 

32 

33 Inspired by https://pypi.python.org/pypi/Extremes. 

34 

35 Examples: 

36 >>> from sys import maxint 

37 >>> AbsMin < -maxint 

38 # Output: True 

39 >>> AbsMin < None 

40 # Output: True 

41 >>> AbsMin < '' 

42 # Output: True 

43 """ 

44 

45 def __le__(self, other: Any): 

46 """LessThanOrEqual.""" 

47 return other is not AbsMin