Skip to content

Commit 8d43266

Browse files
committed
style: format
1 parent e2588ad commit 8d43266

2 files changed

Lines changed: 17 additions & 22 deletions

File tree

packages/griffelib/tests/test_expressions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,10 @@ def func[Z](arg1: T, arg2: Y): pass
238238
[
239239
# Single quotes only in literal parts → double-quote delimiter.
240240
('f"it\'s {x}"', 'f"it\'s {x}"'),
241-
('f"don\'t {x} won\'t {y}"', 'f"don\'t {x} won\'t {y}"'),
241+
("f\"don't {x} won't {y}\"", "f\"don't {x} won't {y}\""),
242242
# Double quotes only in literal parts → single-quote delimiter.
243243
("f'say \"hello\" to {x}'", "f'say \"hello\" to {x}'"),
244-
("f'\"open\" and \"close\" around {x}'", "f'\"open\" and \"close\" around {x}'"),
244+
('f\'"open" and "close" around {x}\'', 'f\'"open" and "close" around {x}\''),
245245
# Both quote types in literal parts → triple-single-quote delimiter.
246246
(r"""f'it\'s "complicated" {x}'""", "f'''it's \"complicated\" {x}'''"),
247247
(r"""f'she said "it\'s fine" to {x}'""", "f'''she said \"it's fine\" to {x}'''"),
@@ -251,8 +251,8 @@ def func[Z](arg1: T, arg2: Y): pass
251251
("f'{{opening}} {x} {{closing}}'", "f'{{opening}} {x} {{closing}}'"),
252252
# String literals inside f-string expressions are never type annotations.
253253
# The expression content drives delimiter choice (single → use double outer).
254-
("f'{print(\"1\")}'", 'f"{print(\'1\')}"'),
255-
("f'{x + \"hello\"}'", 'f"{x + \'hello\'}"'),
254+
("f'{print(\"1\")}'", "f\"{print('1')}\""),
255+
("f'{x + \"hello\"}'", "f\"{x + 'hello'}\""),
256256
],
257257
)
258258
def test_fstring_quote_selection(code: str, expected: str) -> None:

packages/griffelib/tests/test_nodes.py

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,20 @@
5252
"call(something=something)",
5353
# Strings.
5454
"f'a {round(key, 2)} {z}'",
55-
# YORE: EOL 3.13: Replace line with `"t'a {round(key, 2)} {z}'",`.
55+
'f"it\'s {x}"', # ' only -> " delimiter
56+
"f\"don't {x} won't {y}\"", # multiple ' -> " delimiter
57+
"f'say \"hello\" to {x}'", # " only -> ' delimiter
58+
'f\'"quoted" and "re-quoted" {x}\'', # multiple " -> ' delimiter
59+
"f'''it's \"complicated\" {x}'''", # both -> triple-' delimiter
60+
"f'''she said \"it's fine\" to {x}'''", # both, different parts -> triple-'
61+
# YORE: EOL 3.13: Regex-replace `\*\(\[(.+)\].+\),` with `\1,` within line.
5662
*(["t'a {round(key, 2)} {z}'"] if sys.version_info >= (3, 14) else []),
57-
# f-strings with quote characters in literal parts (gh-444).
58-
'f"it\'s {x}"', # ' only → " delimiter
59-
'f"don\'t {x} won\'t {y}"', # multiple ' → " delimiter
60-
"f'say \"hello\" to {x}'", # " only → ' delimiter
61-
"f'\"quoted\" and \"re-quoted\" {x}'", # multiple " → ' delimiter
62-
"f'''it's \"complicated\" {x}'''", # both → triple-' delimiter
63-
"f'''she said \"it's fine\" to {x}'''", # both, different parts → triple-'
64-
# YORE: EOL 3.13: Replace block with lines 2-4.
65-
*(
66-
[
67-
't"it\'s {x}"',
68-
"t'say \"hello\" to {x}'",
69-
"t'''it's \"complicated\" {x}'''",
70-
]
71-
if sys.version_info >= (3, 14)
72-
else []
73-
),
63+
# YORE: EOL 3.13: Regex-replace `\*\(\[(.+)\].+\),` with `\1,` within line.
64+
*(['t"it\'s {x}"'] if sys.version_info >= (3, 14) else []),
65+
# YORE: EOL 3.13: Regex-replace `\*\(\[(.+)\].+\),` with `\1,` within line.
66+
*(["t'say \"hello\" to {x}'"] if sys.version_info >= (3, 14) else []),
67+
# YORE: EOL 3.13: Regex-replace `\*\(\[(.+)\].+\),` with `\1,` within line.
68+
*(["t'''it's \"complicated\" {x}'''"] if sys.version_info >= (3, 14) else []),
7469
# Slices.
7570
"o[x]",
7671
"o[x, y]",

0 commit comments

Comments
 (0)