Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ea25180 commit 0b281f9Copy full SHA for 0b281f9
1 file changed
Lib/test/test_asdl_parser.py
@@ -1,6 +1,7 @@
1
"""Tests for the asdl parser in Parser/asdl.py"""
2
3
import importlib.machinery
4
+import importlib.util
5
import os
6
from os.path import dirname
7
import sys
@@ -26,7 +27,10 @@ def setUpClass(cls):
26
27
sys.path.insert(0, parser_dir)
28
loader = importlib.machinery.SourceFileLoader(
29
'asdl', os.path.join(parser_dir, 'asdl.py'))
- cls.asdl = loader.load_module()
30
+ spec = importlib.util.spec_from_loader('asdl', loader)
31
+ module = importlib.util.module_from_spec(spec)
32
+ loader.exec_module(module)
33
+ cls.asdl = module
34
cls.mod = cls.asdl.parse(os.path.join(parser_dir, 'Python.asdl'))
35
cls.assertTrue(cls.asdl.check(cls.mod), 'Module validation failed')
36
0 commit comments