Repository: psf/black
File: tests/data/preview/long_strings.py (Python)

Code before:
    "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),
}

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",
]

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",
}

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 = (

Review comment (suggestion):
I would've thought this would be wrapped too, but it isn't because there isn't a trailing comma. Not sure if that's intentional or simply an oversight. It's probably better to keep it unwrapped though.

Code after:
        "This is a really really really long string that has to go inside of a"
        " dictionary. It is %s bad (#%d)."
    )
    % ("soooo", 2),
}

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",
]

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",
}

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",
    (