mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	gh-84623: Move imports in doctests (#94133)
Move imports in doctests to prevent false alarms in pyflakes.
This commit is contained in:
		
							parent
							
								
									c1fb12e5af
								
							
						
					
					
						commit
						e52009d3f6
					
				
					 3 changed files with 5 additions and 5 deletions
				
			
		|  | @ -4,7 +4,6 @@ | |||
| 
 | ||||
| from test import support | ||||
| from test.support import import_helper | ||||
| from test.support import os_helper | ||||
| import doctest | ||||
| import functools | ||||
| import os | ||||
|  | @ -14,7 +13,6 @@ | |||
| import importlib.util | ||||
| import unittest | ||||
| import tempfile | ||||
| import shutil | ||||
| import types | ||||
| import contextlib | ||||
| 
 | ||||
|  | @ -461,7 +459,7 @@ def basics(): r""" | |||
|     >>> tests = finder.find(sample_func) | ||||
| 
 | ||||
|     >>> print(tests)  # doctest: +ELLIPSIS | ||||
|     [<DocTest sample_func from test_doctest.py:34 (1 example)>] | ||||
|     [<DocTest sample_func from test_doctest.py:32 (1 example)>] | ||||
| 
 | ||||
| The exact name depends on how test_doctest was invoked, so allow for | ||||
| leading path components. | ||||
|  | @ -2811,6 +2809,8 @@ def test_lineendings(): r""" | |||
| at least one of the line endings will raise a ValueError for inconsistent | ||||
| whitespace if doctest does not correctly do the newline conversion. | ||||
| 
 | ||||
|     >>> from test.support import os_helper | ||||
|     >>> import shutil | ||||
|     >>> dn = tempfile.mkdtemp() | ||||
|     >>> pkg = os.path.join(dn, "doctest_testpkg") | ||||
|     >>> os.mkdir(pkg) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Victor Stinner
						Victor Stinner