mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	 692a49394d
			
		
	
	
		692a49394d
		
	
	
	
	
		
			
			- Change the fixers used in tests to something not provided by lib2to3 - Test conversion of doctests in text files - Factor out test boilerplate into a common method
		
			
				
	
	
		
			16 lines
		
	
	
	
		
			430 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
	
		
			430 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| # Example custom fixer, derived from fix_raw_input by Andre Roberge
 | |
| 
 | |
| from lib2to3 import fixer_base
 | |
| from lib2to3.fixer_util import Name
 | |
| 
 | |
| 
 | |
| class FixEcho2(fixer_base.BaseFix):
 | |
| 
 | |
|     BM_compatible = True
 | |
|     PATTERN = """
 | |
|               power< name='echo2' trailer< '(' [any] ')' > any* >
 | |
|               """
 | |
| 
 | |
|     def transform(self, node, results):
 | |
|         name = results['name']
 | |
|         name.replace(Name('print', prefix=name.prefix))
 |