From 31fbd1982f9511c5b7bce93eb133110811f90e0f Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Langa?= Date: Thu, 17 May 2018 11:19:32 -0700 Subject: [PATCH] Avoid treating ellipsis as a dot delimiter --- black.py | 2 +- tests/comments2.py | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/black.py b/black.py index c48b8d1..a1a3468 100644 --- a/black.py +++ b/black.py @@ -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 diff --git a/tests/comments2.py b/tests/comments2.py index 2045c93..32a2ab3 100644 --- a/tests/comments2.py +++ b/tests/comments2.py @@ -23,6 +23,25 @@ __all__ = [ '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 @@ __all__ = [ "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: -- 2.39.5