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

Added _collections_abc to standard library modules #2279

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion scripts/mkstdlibs.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class FakeApp:
invdata = fetch_inventory(FakeApp(), "", url)

# Any modules we want to enforce across Python versions stdlib can be included in set init
modules = {"_ast", "posixpath", "ntpath", "sre_constants", "sre_parse", "sre_compile", "sre"}
modules = {"_ast", "posixpath", "ntpath", "sre_constants", "sre_parse", "sre_compile", "sre", "_collections_abc"}
for module in invdata["py:module"]:
root, *_ = module.split(".")
if root not in ["__future__", "__main__"]:
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/test_isort.py
Original file line number Diff line number Diff line change
Expand Up @@ -5671,3 +5671,19 @@ def test_reexport_not_last_line() -> None:
meme = "rickroll"
"""
assert isort.code(test_input, config=Config(sort_reexports=True)) == expd_output


def test_collections_abc() -> None:
test_input = (
"from typing import Iterable, Iterator, TypeVar, cast\n"
"\n"
"from _collections_abc import dict_items, dict_keys, dict_values\n"
"from python_none_objects import NoneIterable\n"
)
expd_output = (
"from typing import Iterable, Iterator, TypeVar, cast\n"
"from _collections_abc import dict_items, dict_keys, dict_values\n"
"\n"
"from python_none_objects import NoneIterable\n"
)
assert isort.code(test_input) == expd_output