mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00
23 lines
683 B
Python
23 lines
683 B
Python
"""Regression test for #10451.
|
|
|
|
Annotations in a class are allowed to be forward references
|
|
if `from __future__ import annotations` is active,
|
|
even if they're in a class included in
|
|
`lint.flake8-type-checking.runtime-evaluated-base-classes`.
|
|
|
|
They're not allowed to refer to symbols that cannot be *resolved*
|
|
at runtime, however.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from sqlalchemy.orm import DeclarativeBase, Mapped
|
|
|
|
|
|
class Base(DeclarativeBase):
|
|
some_mapping: Mapped[list[Bar]] | None = None # Should not trigger F821 (resolveable forward reference)
|
|
simplified: list[Bar] | None = None # Should not trigger F821 (resolveable forward reference)
|
|
|
|
|
|
class Bar:
|
|
pass
|