mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Issue #16761: Raise TypeError when int() called with base argument only.
This commit is contained in:
		
						commit
						c819b077bb
					
				
					 3 changed files with 14 additions and 13 deletions
				
			
		|  | @ -233,16 +233,8 @@ def test_keyword_args(self): | |||
|         self.assertEqual(int(x=1.2), 1) | ||||
|         self.assertEqual(int('100', base=2), 4) | ||||
|         self.assertEqual(int(x='100', base=2), 4) | ||||
| 
 | ||||
|     # For example, PyPy 1.9.0 raised TypeError for these cases because it | ||||
|     # expects x to be a string if base is given. | ||||
|     @support.cpython_only | ||||
|     def test_base_arg_with_no_x_arg(self): | ||||
|         self.assertEqual(int(base=6), 0) | ||||
|         # Even invalid bases don't raise an exception. | ||||
|         self.assertEqual(int(base=1), 0) | ||||
|         self.assertEqual(int(base=1000), 0) | ||||
|         self.assertEqual(int(base='foo'), 0) | ||||
|         self.assertRaises(TypeError, int, base=10) | ||||
|         self.assertRaises(TypeError, int, base=0) | ||||
| 
 | ||||
|     def test_int_base_limits(self): | ||||
|         """Testing the supported limits of the int() base parameter.""" | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Serhiy Storchaka
						Serhiy Storchaka