Skip to content

Commit

Permalink
Add tests for dotted imports of __future__
Browse files Browse the repository at this point in the history
  • Loading branch information
thatbirdguythatuknownot authored Apr 25, 2024
1 parent 1140f73 commit 3a4ebb5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Lib/test/test_future_stmt/test_future.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,20 @@ def test_syntactical_future_repl(self):
out = kill_python(p)
self.assertNotIn(b'SyntaxError: invalid syntax', out)

def test_future_dotted_import(self):
with self.assertRaises(ImportError):
from .__future__ import annotations

with self.assertRaises(ImportError):
from __future__ import print_function
from ...__future__ import annotations

code = """
from .__future__ import nested_scopes
from __future__ import barry_as_FLUFL
"""
self.assertSyntaxError(code, lineno=2)

class AnnotationsFutureTestCase(unittest.TestCase):
template = dedent(
"""
Expand Down

0 comments on commit 3a4ebb5

Please sign in to comment.