MCPcopy Index your code
hub / github.com/python/cpython / test_mixed_comparisons

Method test_mixed_comparisons

Lib/test/test_numeric_tower.py:174–203  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

172
173class ComparisonTest(unittest.TestCase):
174 def test_mixed_comparisons(self):
175
176 # ordered list of distinct test values of various types:
177 # int, float, Fraction, Decimal
178 test_values = [
179 float('-inf'),
180 D('-1e425000000'),
181 -1e308,
182 F(-22, 7),
183 -3.14,
184 -2,
185 0.0,
186 1e-320,
187 True,
188 F('1.2'),
189 D('1.3'),
190 float('1.4'),
191 F(275807, 195025),
192 D('1.414213562373095048801688724'),
193 F(114243, 80782),
194 F(473596569, 84615),
195 7e200,
196 D('infinity'),
197 ]
198 for i, first in enumerate(test_values):
199 for second in test_values[i+1:]:
200 self.assertLess(first, second)
201 self.assertLessEqual(first, second)
202 self.assertGreater(second, first)
203 self.assertGreaterEqual(second, first)
204
205 def test_complex(self):
206 # comparisons with complex are special: equality and inequality

Callers

nothing calls this directly

Calls 7

DClass · 0.90
enumerateFunction · 0.85
assertLessEqualMethod · 0.80
assertGreaterMethod · 0.80
assertGreaterEqualMethod · 0.80
FClass · 0.70
assertLessMethod · 0.45

Tested by

no test coverage detected