mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Issue 2354: Fix-up compare warning. Patch contributed by Jeff Balogh.
This commit is contained in:
		
							parent
							
								
									977eb021f3
								
							
						
					
					
						commit
						05387861ea
					
				
					 2 changed files with 15 additions and 1 deletions
				
			
		|  | @ -91,6 +91,20 @@ def test_builtin_function_or_method_comparisons(self): | |||
|     def assertWarning(self, _, warning, expected_message): | ||||
|         self.assertEqual(str(warning.message), expected_message) | ||||
| 
 | ||||
|     def test_sort_cmp_arg(self): | ||||
|         expected = "In 3.x, the cmp argument is no longer supported." | ||||
|         lst = range(5) | ||||
|         cmp = lambda x,y: -1 | ||||
| 
 | ||||
|         with catch_warning() as w: | ||||
|             self.assertWarning(lst.sort(cmp=cmp), w, expected) | ||||
|         with catch_warning() as w: | ||||
|             self.assertWarning(sorted(lst, cmp=cmp), w, expected) | ||||
|         with catch_warning() as w: | ||||
|             self.assertWarning(lst.sort(cmp), w, expected) | ||||
|         with catch_warning() as w: | ||||
|             self.assertWarning(sorted(lst, cmp), w, expected) | ||||
| 
 | ||||
| def test_main(): | ||||
|     run_unittest(TestPy3KWarnings) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Raymond Hettinger
						Raymond Hettinger