Changeset 391 for python/trunk/Lib/test/test_richcmp.py
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Lib/test/test_richcmp.py
r2 r391 107 107 for i in xrange(len(realres)): 108 108 # results are bool, so we can use "is" here 109 self.assert _(realres[i] is expres[i])109 self.assertTrue(realres[i] is expres[i]) 110 110 111 111 def test_mixed(self): … … 164 164 realres = op(ta, tb) 165 165 realres = getattr(realres, "x", realres) 166 self.assert _(realres is expres)166 self.assertTrue(realres is expres) 167 167 168 168 def test_values(self): … … 193 193 def test_misbehavin(self): 194 194 class Misb: 195 def __lt__(self , other): return 0196 def __gt__(self , other): return 0197 def __eq__(self , other): return 0198 def __le__(self , other): raise test_support.TestFailed, "This shouldn't happen"199 def __ge__(self , other): raise test_support.TestFailed, "This shouldn't happen"200 def __ne__(self , other): raise test_support.TestFailed, "This shouldn't happen"201 def __cmp__(self , other): raise RuntimeError, "expected"195 def __lt__(self_, other): return 0 196 def __gt__(self_, other): return 0 197 def __eq__(self_, other): return 0 198 def __le__(self_, other): self.fail("This shouldn't happen") 199 def __ge__(self_, other): self.fail("This shouldn't happen") 200 def __ne__(self_, other): self.fail("This shouldn't happen") 201 def __cmp__(self_, other): raise RuntimeError, "expected" 202 202 a = Misb() 203 203 b = Misb() … … 240 240 # Even recursive lists of different lengths are different, 241 241 # but they cannot be ordered 242 self.assert _(not (a == b))243 self.assert _(a != b)242 self.assertTrue(not (a == b)) 243 self.assertTrue(a != b) 244 244 self.assertRaises(RuntimeError, operator.lt, a, b) 245 245 self.assertRaises(RuntimeError, operator.le, a, b) … … 251 251 a.insert(0, 11) 252 252 b.insert(0, 12) 253 self.assert _(not (a == b))254 self.assert _(a != b)255 self.assert _(a < b)253 self.assertTrue(not (a == b)) 254 self.assertTrue(a != b) 255 self.assertTrue(a < b) 256 256 257 257 class DictTest(unittest.TestCase): … … 272 272 imag2 = imag1b.copy() 273 273 imag2[k] = v + 1.0 274 self.assert _(imag1a == imag1a)275 self.assert _(imag1a == imag1b)276 self.assert _(imag2 == imag2)277 self.assert _(imag1a != imag2)274 self.assertTrue(imag1a == imag1a) 275 self.assertTrue(imag1a == imag1b) 276 self.assertTrue(imag2 == imag2) 277 self.assertTrue(imag1a != imag2) 278 278 for opname in ("lt", "le", "gt", "ge"): 279 279 for op in opmap[opname]: … … 281 281 282 282 class ListTest(unittest.TestCase): 283 284 def assertIs(self, a, b):285 self.assert_(a is b)286 283 287 284 def test_coverage(self): … … 331 328 332 329 def test_main(): 333 test_support.run_unittest(VectorTest, NumberTest, MiscTest, DictTest, ListTest) 330 test_support.run_unittest(VectorTest, NumberTest, MiscTest, ListTest) 331 with test_support.check_py3k_warnings(("dict inequality comparisons " 332 "not supported in 3.x", 333 DeprecationWarning)): 334 test_support.run_unittest(DictTest) 335 334 336 335 337 if __name__ == "__main__":
Note:
See TracChangeset
for help on using the changeset viewer.