mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
[3.13] gh-117174: Add a new route in linecache to fetch interactive source code (GH-117500) (#131060)
gh-117174: Add a new route in linecache to fetch interactive source code (GH-117500)
(cherry picked from commit a931a8b324
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
parent
ebd2ed7ad8
commit
c7022230d2
16 changed files with 142 additions and 93 deletions
|
@ -8,6 +8,7 @@ import tokenize
|
|||
from importlib.machinery import ModuleSpec
|
||||
from test import support
|
||||
from test.support import os_helper
|
||||
from test.support.script_helper import assert_python_ok
|
||||
|
||||
|
||||
FILENAME = linecache.__file__
|
||||
|
@ -311,6 +312,12 @@ class LineCacheTests(unittest.TestCase):
|
|||
# just to be sure that we did not mess with cache
|
||||
linecache.clearcache()
|
||||
|
||||
def test_linecache_python_string(self):
|
||||
cmdline = "import linecache;assert len(linecache.cache) == 0"
|
||||
retcode, stdout, stderr = assert_python_ok('-c', cmdline)
|
||||
self.assertEqual(retcode, 0)
|
||||
self.assertEqual(stdout, b'')
|
||||
self.assertEqual(stderr, b'')
|
||||
|
||||
class LineCacheInvalidationTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue