Skip to content

Commit 155dbeb

Browse files
authored
handle star imports for alias (#5743)
1 parent 76457c4 commit 155dbeb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

reflex/utils/imports.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def name(self) -> str:
135135
if self.alias:
136136
return (
137137
self.alias
138-
if self.is_default
138+
if self.is_default and self.tag != "*"
139139
else (self.tag + " as " + self.alias if self.tag else self.alias)
140140
)
141141
return self.tag or ""

tests/units/utils/test_imports.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@
3636
ImportVar(tag="BaseTag", is_default=False, alias="AliasTag"),
3737
"BaseTag as AliasTag",
3838
),
39+
(
40+
ImportVar(tag="*", alias="AliasTag"),
41+
"* as AliasTag",
42+
),
3943
],
4044
)
41-
def test_import_var(import_var, expected_name):
45+
def test_import_var(import_var: ImportVar, expected_name: str):
4246
"""Test that the import var name is computed correctly.
4347
4448
Args:

0 commit comments

Comments
 (0)