Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing attrs.converters/filters, fortify type tests #931

Merged
merged 1 commit into from
Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/attrs/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ from attr import __version_info__ as __version_info__
from attr import _FilterType
from attr import assoc as assoc
from attr import Attribute as Attribute
from attr import converters as converters
from attr import define as define
from attr import evolve as evolve
from attr import Factory as Factory
from attr import exceptions as exceptions
from attr import Factory as Factory
from attr import field as field
from attr import fields as fields
from attr import fields_dict as fields_dict
from attr import filters as filters
from attr import frozen as frozen
from attr import has as has
from attr import make_class as make_class
Expand Down
28 changes: 12 additions & 16 deletions tests/typing_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,27 +394,23 @@ class MatchArgs2:
attrs.astuple(MatchArgs2(1, 2))


def importing_from_attr() -> None:
def accessing_from_attr() -> None:
"""
Use a function to keep the ns clean.
"""
from attr.converters import optional
from attr.exceptions import FrozenError
from attr.filters import include
from attr.setters import frozen
from attr.validators import and_
attr.converters.optional
attr.exceptions.FrozenError
attr.filters.include
attr.setters.frozen
attr.validators.and_

assert optional and FrozenError and include and frozen and and_


def importing_from_attrs() -> None:
def accessing_from_attrs() -> None:
"""
Use a function to keep the ns clean.
"""
from attrs.converters import optional
from attrs.exceptions import FrozenError
from attrs.filters import include
from attrs.setters import frozen
from attrs.validators import and_

assert optional and FrozenError and include and frozen and and_
attrs.converters.optional
attrs.exceptions.FrozenError
attrs.filters.include
attrs.setters.frozen
attrs.validators.and_