brought back interface examplest test

This commit is contained in:
Abubakar Abid 2022-03-25 11:34:55 -07:00
parent fd70292fbe
commit 12db19e6ab

View File

@ -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):