Skip to content

Commit 3a4ebb5

Browse files
Add tests for dotted imports of __future__
1 parent 1140f73 commit 3a4ebb5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Lib/test/test_future_stmt/test_future.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,20 @@ def test_syntactical_future_repl(self):
203203
out = kill_python(p)
204204
self.assertNotIn(b'SyntaxError: invalid syntax', out)
205205

206+
def test_future_dotted_import(self):
207+
with self.assertRaises(ImportError):
208+
from .__future__ import annotations
209+
210+
with self.assertRaises(ImportError):
211+
from __future__ import print_function
212+
from ...__future__ import annotations
213+
214+
code = """
215+
from .__future__ import nested_scopes
216+
from __future__ import barry_as_FLUFL
217+
"""
218+
self.assertSyntaxError(code, lineno=2)
219+
206220
class AnnotationsFutureTestCase(unittest.TestCase):
207221
template = dedent(
208222
"""

0 commit comments

Comments
 (0)