| 1 |
'''''' |
| 2 |
|
| 3 |
'\'' |
| 4 |
'"' |
| 5 |
"'" |
| 6 |
"\"" |
| 7 |
"Hello" |
| 8 |
"Don't do that" |
| 9 |
'Here is a "' |
| 10 |
'What\'s the deal here?' |
| 11 |
"What's the deal \"here\"?" |
| 12 |
"And \"here\"?" |
| 13 |
"""Strings with "" in them""" |
| 14 |
'''Strings with "" in them''' |
| 15 |
'''Here's a "''' |
| 16 |
'''Here's a " ''' |
| 17 |
'''Just a normal triple |
| 18 |
quote''' |
| 19 |
f"just a normal {f} string" |
| 20 |
f'''This is a triple-quoted {f}-string''' |
| 21 |
f'MOAR {" ".join([])}' |
| 22 |
f"MOAR {' '.join([])}" |
| 23 |
r"raw string ftw" |
| 24 |
r'Date d\'expiration:(.*)' |
| 25 |
r'Tricky "quote' |
| 26 |
r'Not-so-tricky \"quote' |
| 27 |
rf'{yay}' |
| 28 |
'\n\ |
| 29 |
The \"quick\"\n\ |
| 30 |
brown fox\n\ |
| 31 |
jumps over\n\ |
| 32 |
the \'lazy\' dog.\n\ |
| 33 |
' |
| 34 |
re.compile(r'[\\"]') |
| 35 |
"x = ''; y = \"\"" |
| 36 |
"x = '''; y = \"\"" |
| 37 |
"x = ''''; y = \"\"" |
| 38 |
"x = '' ''; y = \"\"" |
| 39 |
"x = ''; y = \"\"\"" |
| 40 |
"x = '''; y = \"\"\"\"" |
| 41 |
"x = ''''; y = \"\"\"\"\"" |
| 42 |
"x = '' ''; y = \"\"\"\"\"" |
| 43 |
'unnecessary \"\"escaping' |
| 44 |
"unnecessary \'\'escaping" |
| 45 |
'\\""' |
| 46 |
"\\''" |
| 47 |
'Lots of \\\\\\\\\'quotes\'' |
| 48 |
f'{y * " "} \'{z}\'' |
| 49 |
f'{{y * " "}} \'{z}\'' |
| 50 |
f'\'{z}\' {y * " "}' |
| 51 |
f'{y * x} \'{z}\'' |
| 52 |
'\'{z}\' {y * " "}' |
| 53 |
'{y * x} \'{z}\'' |
| 54 |
|
| 55 |
# We must bail out if changing the quotes would introduce backslashes in f-string |
| 56 |
# expressions. xref: https://github.com/psf/black/issues/2348 |
| 57 |
f"\"{b}\"{' ' * (long-len(b)+1)}: \"{sts}\",\n" |
| 58 |
f"\"{a}\"{'hello' * b}\"{c}\"" |
| 59 |
|
| 60 |
# output |
| 61 |
|
| 62 |
"""""" |
| 63 |
|
| 64 |
"'" |
| 65 |
'"' |
| 66 |
"'" |
| 67 |
'"' |
| 68 |
"Hello" |
| 69 |
"Don't do that" |
| 70 |
'Here is a "' |
| 71 |
"What's the deal here?" |
| 72 |
'What\'s the deal "here"?' |
| 73 |
'And "here"?' |
| 74 |
"""Strings with "" in them""" |
| 75 |
"""Strings with "" in them""" |
| 76 |
'''Here's a "''' |
| 77 |
"""Here's a " """ |
| 78 |
"""Just a normal triple |
| 79 |
quote""" |
| 80 |
f"just a normal {f} string" |
| 81 |
f"""This is a triple-quoted {f}-string""" |
| 82 |
f'MOAR {" ".join([])}' |
| 83 |
f"MOAR {' '.join([])}" |
| 84 |
r"raw string ftw" |
| 85 |
r"Date d\'expiration:(.*)" |
| 86 |
r'Tricky "quote' |
| 87 |
r"Not-so-tricky \"quote" |
| 88 |
rf"{yay}" |
| 89 |
"\nThe \"quick\"\nbrown fox\njumps over\nthe 'lazy' dog.\n" |
| 90 |
re.compile(r'[\\"]') |
| 91 |
"x = ''; y = \"\"" |
| 92 |
"x = '''; y = \"\"" |
| 93 |
"x = ''''; y = \"\"" |
| 94 |
"x = '' ''; y = \"\"" |
| 95 |
'x = \'\'; y = """' |
| 96 |
'x = \'\'\'; y = """"' |
| 97 |
'x = \'\'\'\'; y = """""' |
| 98 |
'x = \'\' \'\'; y = """""' |
| 99 |
'unnecessary ""escaping' |
| 100 |
"unnecessary ''escaping" |
| 101 |
'\\""' |
| 102 |
"\\''" |
| 103 |
"Lots of \\\\\\\\'quotes'" |
| 104 |
f'{y * " "} \'{z}\'' |
| 105 |
f"{{y * \" \"}} '{z}'" |
| 106 |
f'\'{z}\' {y * " "}' |
| 107 |
f"{y * x} '{z}'" |
| 108 |
"'{z}' {y * \" \"}" |
| 109 |
"{y * x} '{z}'" |
| 110 |
|
| 111 |
# We must bail out if changing the quotes would introduce backslashes in f-string |
| 112 |
# expressions. xref: https://github.com/psf/black/issues/2348 |
| 113 |
f"\"{b}\"{' ' * (long-len(b)+1)}: \"{sts}\",\n" |
| 114 |
f"\"{a}\"{'hello' * b}\"{c}\"" |