gradio/test/components/test_html.py
Hannah 492d422df6
Amend show_label in gr.HTML to show optional label (#9024)
* amend show_label param and add label to component

* fix test

* fix test

* fix test
2024-08-07 09:19:56 -07:00

33 lines
854 B
Python

import gradio as gr
class TestHTML:
def test_component_functions(self):
"""
get_config
"""
html_component = gr.components.HTML("#Welcome onboard", label="HTML Input")
assert html_component.get_config() == {
"value": "#Welcome onboard",
"label": "HTML Input",
"show_label": False,
"visible": True,
"elem_id": None,
"elem_classes": [],
"proxy_url": None,
"name": "html",
"_selectable": False,
"key": None,
}
def test_in_interface(self):
"""
Interface, process
"""
def bold_text(text):
return f"<strong>{text}</strong>"
iface = gr.Interface(bold_text, "text", "html")
assert iface("test") == "<strong>test</strong>"