Skip to content

Commit

Permalink
import hotfix (#1008)
Browse files Browse the repository at this point in the history
  • Loading branch information
omerXfaruq authored Apr 15, 2022
1 parent 0e1dce6 commit f511174
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gradio/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ def get_component_shortcut(cls, str_shortcut: str) -> Optional[Component]:
True, found_class or
False, None
"""
# If we do not import templates Python cannot recognize grandchild classes names.
import gradio.templates

# Make it suitable with class names
str_shortcut = str_shortcut.replace("_", "")
for sub_cls in cls.__subclasses__():
Expand Down
8 changes: 8 additions & 0 deletions test/test_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
"""


class TestComponent(unittest.TestCase):
def test_component_functions(self):
"""
component
"""
assert isinstance(gr.component("text"), gr.templates.Text)


class TestTextbox(unittest.TestCase):
def test_component_functions(self):
"""
Expand Down

0 comments on commit f511174

Please sign in to comment.