X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/b73b77a9b039d5afa6ab32202bff2b2232258d45..6ffc5f7b01eab341f1b2cd373b6faed0072a2351:/tests/data/preview/long_strings.py diff --git a/tests/data/preview/long_strings.py b/tests/data/preview/long_strings.py index 9288b25..c68da3a 100644 --- a/tests/data/preview/long_strings.py +++ b/tests/data/preview/long_strings.py @@ -26,15 +26,15 @@ D6 = { # Test for https://github.com/psf/black/issues/3261 ("This is a really long string that can't be expected to fit in one line and is used as a dict's key"): ["value1", "value2"], } -L1 = ["The is a short string", "This is a really long string that can't possibly be expected to fit all together on one line. Also it is inside a list literal, so it's expected to be wrapped in parens when spliting to avoid implicit str concatenation.", short_call("arg", {"key": "value"}), "This is another really really (not really) long string that also can't be expected to fit on one line and is, like the other string, inside a list literal.", ("parens should be stripped for short string in list")] +L1 = ["The is a short string", "This is a really long string that can't possibly be expected to fit all together on one line. Also it is inside a list literal, so it's expected to be wrapped in parens when splitting to avoid implicit str concatenation.", short_call("arg", {"key": "value"}), "This is another really really (not really) long string that also can't be expected to fit on one line and is, like the other string, inside a list literal.", ("parens should be stripped for short string in list")] L2 = ["This is a really long string that can't be expected to fit in one line and is the only child of a list literal."] -S1 = {"The is a short string", "This is a really long string that can't possibly be expected to fit all together on one line. Also it is inside a set literal, so it's expected to be wrapped in parens when spliting to avoid implicit str concatenation.", short_call("arg", {"key": "value"}), "This is another really really (not really) long string that also can't be expected to fit on one line and is, like the other string, inside a set literal.", ("parens should be stripped for short string in set")} +S1 = {"The is a short string", "This is a really long string that can't possibly be expected to fit all together on one line. Also it is inside a set literal, so it's expected to be wrapped in parens when splitting to avoid implicit str concatenation.", short_call("arg", {"key": "value"}), "This is another really really (not really) long string that also can't be expected to fit on one line and is, like the other string, inside a set literal.", ("parens should be stripped for short string in set")} S2 = {"This is a really long string that can't be expected to fit in one line and is the only child of a set literal."} -T1 = ("The is a short string", "This is a really long string that can't possibly be expected to fit all together on one line. Also it is inside a tuple literal, so it's expected to be wrapped in parens when spliting to avoid implicit str concatenation.", short_call("arg", {"key": "value"}), "This is another really really (not really) long string that also can't be expected to fit on one line and is, like the other string, inside a tuple literal.", ("parens should be stripped for short string in list")) +T1 = ("The is a short string", "This is a really long string that can't possibly be expected to fit all together on one line. Also it is inside a tuple literal, so it's expected to be wrapped in parens when splitting to avoid implicit str concatenation.", short_call("arg", {"key": "value"}), "This is another really really (not really) long string that also can't be expected to fit on one line and is, like the other string, inside a tuple literal.", ("parens should be stripped for short string in list")) T2 = ("This is a really long string that can't be expected to fit in one line and is the only child of a tuple literal.",) @@ -278,6 +278,32 @@ string_with_escaped_nameescape = ( "........................................................................... \\N{LAO KO LA}" ) +msg = lambda x: f"this is a very very very long lambda value {x} that doesn't fit on a single line" + +dict_with_lambda_values = { + "join": lambda j: ( + f"{j.__class__.__name__}({some_function_call(j.left)}, " + f"{some_function_call(j.right)})" + ), +} + +# Complex string concatenations with a method call in the middle. +code = ( + (" return [\n") + + ( + ", \n".join( + " (%r, self.%s, visitor.%s)" + % (attrname, attrname, visit_name) + for attrname, visit_name in names + ) + ) + + ("\n ]\n") +) + + +# Test case of an outer string' parens enclose an inner string's parens. +call(body=("%s %s" % ((",".join(items)), suffix))) + # output @@ -362,9 +388,8 @@ D4 = { "A %s %s" % ("formatted", "string"): ( "This is a really really really long string that has to go inside of a" - " dictionary. It is %s bad (#%d)." - ) - % ("soooo", 2), + " dictionary. It is %s bad (#%d)." % ("soooo", 2) + ), } D5 = { # Test for https://github.com/psf/black/issues/3261 @@ -385,7 +410,7 @@ L1 = [ ( "This is a really long string that can't possibly be expected to fit all" " together on one line. Also it is inside a list literal, so it's expected to" - " be wrapped in parens when spliting to avoid implicit str concatenation." + " be wrapped in parens when splitting to avoid implicit str concatenation." ), short_call("arg", {"key": "value"}), ( @@ -406,7 +431,7 @@ S1 = { ( "This is a really long string that can't possibly be expected to fit all" " together on one line. Also it is inside a set literal, so it's expected to be" - " wrapped in parens when spliting to avoid implicit str concatenation." + " wrapped in parens when splitting to avoid implicit str concatenation." ), short_call("arg", {"key": "value"}), ( @@ -427,7 +452,7 @@ T1 = ( ( "This is a really long string that can't possibly be expected to fit all" " together on one line. Also it is inside a tuple literal, so it's expected to" - " be wrapped in parens when spliting to avoid implicit str concatenation." + " be wrapped in parens when splitting to avoid implicit str concatenation." ), short_call("arg", {"key": "value"}), ( @@ -806,3 +831,31 @@ string_with_escaped_nameescape = ( "..........................................................................." " \\N{LAO KO LA}" ) + +msg = ( + lambda x: ( + f"this is a very very very long lambda value {x} that doesn't fit on a single" + " line" + ) +) + +dict_with_lambda_values = { + "join": lambda j: ( + f"{j.__class__.__name__}({some_function_call(j.left)}, " + f"{some_function_call(j.right)})" + ), +} + +# Complex string concatenations with a method call in the middle. +code = ( + " return [\n" + + ", \n".join( + " (%r, self.%s, visitor.%s)" % (attrname, attrname, visit_name) + for attrname, visit_name in names + ) + + "\n ]\n" +) + + +# Test case of an outer string' parens enclose an inner string's parens. +call(body="%s %s" % (",".join(items), suffix))