mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	[3.13] gh-130193: Increase test coverage of gettext.c2py (GH-130208) (GH-130217)
(cherry picked from commit fb2d325725)
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
			
			
This commit is contained in:
		
							parent
							
								
									8f33c7ac17
								
							
						
					
					
						commit
						1b2cfb73f9
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		|  | @ -567,12 +567,18 @@ def test_decimal_number(self): | |||
|     def test_invalid_syntax(self): | ||||
|         invalid_expressions = [ | ||||
|             'x>1', '(n>1', 'n>1)', '42**42**42', '0xa', '1.0', '1e2', | ||||
|             'n>0x1', '+n', '-n', 'n()', 'n(1)', '1+', 'nn', 'n n', | ||||
|             'n>0x1', '+n', '-n', 'n()', 'n(1)', '1+', 'nn', 'n n', 'n ? 1 2' | ||||
|         ] | ||||
|         for expr in invalid_expressions: | ||||
|             with self.assertRaises(ValueError): | ||||
|                 gettext.c2py(expr) | ||||
| 
 | ||||
|     def test_negation(self): | ||||
|         f = gettext.c2py('!!!n') | ||||
|         self.assertEqual(f(0), 1) | ||||
|         self.assertEqual(f(1), 0) | ||||
|         self.assertEqual(f(2), 0) | ||||
| 
 | ||||
|     def test_nested_condition_operator(self): | ||||
|         self.assertEqual(gettext.c2py('n?1?2:3:4')(0), 4) | ||||
|         self.assertEqual(gettext.c2py('n?1?2:3:4')(1), 2) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Miss Islington (bot)
						Miss Islington (bot)