(self)
| 172 | |
| 173 | class 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 |
nothing calls this directly
no test coverage detected