Skip to content

Commit 12d9194

Browse files
committed
minor fix
1 parent f8c0d0c commit 12d9194

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/idom/_console/update_html_usages.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,21 @@ def generate_rewrite(file: Path, source: str) -> None:
8282
match node.args:
8383
case [ast.Dict(keys, values), *_]:
8484
new_kwargs = list(node.keywords)
85+
should_change = True
8586
for k, v in zip(keys, values):
8687
if isinstance(k, ast.Constant) and isinstance(k.value, str):
8788
if k.value == "tagName":
8889
# this is a vdom dict declaration
90+
should_change = False
8991
break
9092
new_kwargs.append(
9193
ast.keyword(arg=conv_attr_name(k.value), value=v)
9294
)
9395
else:
9496
new_kwargs = [ast.keyword(arg=None, value=node.args[0])]
95-
else:
97+
should_change = True
98+
break
99+
if should_change:
96100
node.args = node_args_pre + node.args[1:]
97101
node.keywords = new_kwargs
98102
changed.append((node, *parents))

tests/test__console/test_update_html_usages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ def test_update_html_usages(tmp_path):
3434
"vdom('div', class_name='test')",
3535
),
3636
(
37-
'html.div({class_name: "test", **other})',
38-
"html.div(**{class_name: 'test', **other})",
37+
'html.div({variable: "test", **other, "key": value})',
38+
"html.div(**{variable: 'test', **other, 'key': value})",
3939
),
4040
(
4141
'html.div(dict(other, className="test"))',

0 commit comments

Comments
 (0)