(self)
| 203 | self.assertGreaterEqual(second, first) |
| 204 | |
| 205 | def test_complex(self): |
| 206 | # comparisons with complex are special: equality and inequality |
| 207 | # comparisons should always succeed, but order comparisons should |
| 208 | # raise TypeError. |
| 209 | z = 1.0 + 0j |
| 210 | w = -3.14 + 2.7j |
| 211 | |
| 212 | for v in 1, 1.0, F(1), D(1), complex(1): |
| 213 | self.assertEqual(z, v) |
| 214 | self.assertEqual(v, z) |
| 215 | |
| 216 | for v in 2, 2.0, F(2), D(2), complex(2): |
| 217 | self.assertNotEqual(z, v) |
| 218 | self.assertNotEqual(v, z) |
| 219 | self.assertNotEqual(w, v) |
| 220 | self.assertNotEqual(v, w) |
| 221 | |
| 222 | for v in (1, 1.0, F(1), D(1), complex(1), |
| 223 | 2, 2.0, F(2), D(2), complex(2), w): |
| 224 | for op in operator.le, operator.lt, operator.ge, operator.gt: |
| 225 | self.assertRaises(TypeError, op, z, v) |
| 226 | self.assertRaises(TypeError, op, v, z) |
| 227 | |
| 228 | |
| 229 | if __name__ == '__main__': |
nothing calls this directly
no test coverage detected