gradio/test/test_inputs.py

57 lines
1.0 KiB
Python
Raw Normal View History

2019-02-28 08:43:20 +08:00
import unittest
2020-09-15 20:16:14 +08:00
import gradio as gr
2019-02-28 08:43:20 +08:00
2020-09-15 20:16:14 +08:00
class TestTextbox(unittest.TestCase):
def test_component(self):
box = gr.inputs.Textbox()
assert box.preprocess("Hello") == "Hello"
box = gr.inputs.Textbox(type="str")
assert box.preprocess(125) == 125
def test_interface(self):
iface = gr.Interface(lambda x: x[::-1], "textbox", "textbox")
assert interface.process("Hello") == "olleH"
iface = gr.Interface(lambda x: x*x, "number", "number")
assert interface.process(5) == 25
class TestSlider(unittest.TestCase):
pass
class TestCheckbox(unittest.TestCase):
pass
class TestCheckboxGroup(unittest.TestCase):
pass
class TestRadio(unittest.TestCase):
pass
class TestDropdown(unittest.TestCase):
pass
2020-08-06 01:42:52 +08:00
2019-02-28 08:43:20 +08:00
2020-08-11 04:52:43 +08:00
class TestImage(unittest.TestCase):
2020-09-15 20:16:14 +08:00
pass
2019-02-28 08:43:20 +08:00
2020-09-15 20:16:14 +08:00
class TestAudio(unittest.TestCase):
pass
class TestFile(unittest.TestCase):
pass
class TestDataframe(unittest.TestCase):
pass
2019-02-28 08:43:20 +08:00
if __name__ == '__main__':
2019-06-19 04:13:50 +08:00
unittest.main()