mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-27 01:40:20 +08:00
brought back interface examplest test
This commit is contained in:
parent
fd70292fbe
commit
12db19e6ab
@ -40,26 +40,17 @@ class TestInterface(unittest.TestCase):
|
||||
close_all()
|
||||
interface.close.assert_called()
|
||||
|
||||
# def test_examples_invalid_input(self):
|
||||
# with self.assertRaises(ValueError):
|
||||
# Interface(lambda x: x, examples=1234)
|
||||
def test_examples_invalid_input(self):
|
||||
with self.assertRaises(ValueError):
|
||||
Interface(lambda x: x, examples=1234)
|
||||
|
||||
# def test_examples_valid_path(self):
|
||||
# path = os.path.join(os.path.dirname(__file__), "test_data/flagged_with_log")
|
||||
# interface = Interface(lambda x: 3 * x, "number", "number", examples=path)
|
||||
# self.assertEqual(len(interface.get_config_file()["examples"]), 2)
|
||||
|
||||
# path = os.path.join(os.path.dirname(__file__), "test_data/flagged_no_log")
|
||||
# interface = Interface(lambda x: 3 * x, "number", "number", examples=path)
|
||||
# self.assertEqual(len(interface.get_config_file()["examples"]), 3)
|
||||
|
||||
# def test_examples_not_valid_path(self):
|
||||
# with self.assertRaises(FileNotFoundError):
|
||||
# interface = Interface(
|
||||
# lambda x: x, "textbox", "label", examples="invalid-path"
|
||||
# )
|
||||
# interface.launch(prevent_thread_lock=True)
|
||||
# interface.close()
|
||||
def test_examples_valid_path(self):
|
||||
path = os.path.join(os.path.dirname(__file__), "test_data/flagged_with_log")
|
||||
interface = Interface(lambda x: 3 * x, "number", "number", examples=path)
|
||||
dataset_check = any(
|
||||
[c["type"] == "dataset" for c in interface.get_config_file()["components"]]
|
||||
)
|
||||
self.assertTrue(dataset_check)
|
||||
|
||||
def test_test_launch(self):
|
||||
with captured_output() as (out, err):
|
||||
|
Loading…
Reference in New Issue
Block a user