mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-21 02:19:59 +08:00
914b1935de
* add copy button * add changeset * add changeset * lint * value tweak --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com> Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
24 lines
866 B
Python
24 lines
866 B
Python
import gradio as gr
|
|
|
|
|
|
class TestMarkdown:
|
|
def test_component_functions(self):
|
|
markdown_component = gr.Markdown("# Let's learn about $x$", label="Markdown")
|
|
assert markdown_component.get_config()["value"] == "# Let's learn about $x$"
|
|
assert not markdown_component.get_config()["show_copy_button"]
|
|
|
|
def test_in_interface(self):
|
|
"""
|
|
Interface, process
|
|
"""
|
|
iface = gr.Interface(lambda x: x, "text", "markdown")
|
|
input_data = " Here's an [image](https://gradio.app/images/gradio_logo.png)"
|
|
output_data = iface(input_data)
|
|
assert output_data == input_data.strip()
|
|
|
|
def test_show_copy_button(self):
|
|
markdown_component = gr.Markdown(
|
|
"# Let's learn about $x$", show_copy_button=True
|
|
)
|
|
assert markdown_component.get_config()["show_copy_button"]
|