We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 13ec521 commit 22c2fecCopy full SHA for 22c2fec
roundup/anypy/cmp_.py
@@ -71,6 +71,9 @@ def __gt__(self, other):
71
72
73
def _test():
74
+ import sys
75
+ _py3 = sys.version_info[0] > 2
76
+
77
Comp = NoneAndDictComparable
78
79
assert Comp(None) < Comp(0)
@@ -82,6 +85,13 @@ def _test():
82
85
assert not Comp({}) < Comp(None)
83
86
assert not Comp((0, 0)) < Comp((0, None))
84
87
88
+ try:
89
+ not Comp("") < Comp((0, None))
90
+ if _py3:
91
+ assert False, "Incompatible types are reporting comparable."
92
+ except TypeError:
93
+ pass
94
95
assert Comp((0, 0)) < Comp((0, 0, None))
96
assert Comp((0, None, None)) < Comp((0, 0, 0))
97
@@ -90,6 +100,12 @@ def _test():
100
assert not Comp(1) < Comp(0)
101
assert not Comp(0) > Comp(0)
102
103
104
+ assert Comp(0) <= Comp(1)
105
+ assert Comp(1) >= Comp(0)
106
+ assert not Comp(1) <= Comp(0)
107
+ assert Comp(0) >= Comp(0)
108
109
assert Comp({0: None}) < Comp({0: 0})
110
assert Comp({0: 0}) < Comp({0: 1})
111
0 commit comments