Commit 31fbd198 authored by Łukasz Langa's avatar Łukasz Langa
Browse files

Avoid treating ellipsis as a dot delimiter

parent dd4477b7
Loading
Loading
Loading
Loading
+1 −1
Changes for black.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -1741,7 +1741,7 @@ def is_split_before_delimiter(leaf: Leaf, previous: Leaf = None) -> int:
        leaf.type == token.DOT
        and leaf.parent
        and leaf.parent.type not in {syms.import_from, syms.dotted_name}
        and (previous is None or previous.type != token.NAME)
        and (previous is None or previous.type in CLOSING_BRACKETS)
    ):
        return DOT_PRIORITY

+39 −0
Changes for tests/comments2.py: 39 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -23,6 +23,25 @@
    'Generator',
]

not_shareables = [
    # singletons
    True,
    False,
    NotImplemented, ...,
    # builtin types and objects
    type,
    object,
    object(),
    Exception(),
    42,
    100.0,
    "spam",
    # user-defined types and objects
    Cheese,
    Cheese("Wensleydale"),
    SubBytes(b"spam"),
]

if 'PYTHON' in os.environ:
    add_compiler(compiler_from_env())
else:
@@ -152,6 +171,26 @@ def inline_comments_in_brackets_ruin_everything():
    "Generator",
]

not_shareables = [
    # singletons
    True,
    False,
    NotImplemented,
    ...,
    # builtin types and objects
    type,
    object,
    object(),
    Exception(),
    42,
    100.0,
    "spam",
    # user-defined types and objects
    Cheese,
    Cheese("Wensleydale"),
    SubBytes(b"spam"),
]

if "PYTHON" in os.environ:
    add_compiler(compiler_from_env())
else: