mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	Issue19995: passing a non-int to %o, %c, %x, or %X now raises an exception
This commit is contained in:
		
							parent
							
								
									8e5d0caf92
								
							
						
					
					
						commit
						38d872ee5d
					
				
					 5 changed files with 10 additions and 43 deletions
				
			
		| 
						 | 
				
			
			@ -1149,11 +1149,11 @@ def __int__(self):
 | 
			
		|||
        self.assertEqual('%X' % letter_m, '6D')
 | 
			
		||||
        self.assertEqual('%o' % letter_m, '155')
 | 
			
		||||
        self.assertEqual('%c' % letter_m, 'm')
 | 
			
		||||
        self.assertWarns(DeprecationWarning, '%x'.__mod__, pi),
 | 
			
		||||
        self.assertWarns(DeprecationWarning, '%x'.__mod__, 3.14),
 | 
			
		||||
        self.assertWarns(DeprecationWarning, '%X'.__mod__, 2.11),
 | 
			
		||||
        self.assertWarns(DeprecationWarning, '%o'.__mod__, 1.79),
 | 
			
		||||
        self.assertWarns(DeprecationWarning, '%c'.__mod__, pi),
 | 
			
		||||
        self.assertRaises(TypeError, '%x'.__mod__, pi),
 | 
			
		||||
        self.assertRaises(TypeError, '%x'.__mod__, 3.14),
 | 
			
		||||
        self.assertRaises(TypeError, '%X'.__mod__, 2.11),
 | 
			
		||||
        self.assertRaises(TypeError, '%o'.__mod__, 1.79),
 | 
			
		||||
        self.assertRaises(TypeError, '%c'.__mod__, pi),
 | 
			
		||||
 | 
			
		||||
    def test_formatting_with_enum(self):
 | 
			
		||||
        # issue18780
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue