This commit is contained in:
Ali Abid 2020-06-30 16:31:39 -07:00
commit c1b8b353d8
3 changed files with 11 additions and 11 deletions

View File

@ -11,7 +11,7 @@ PACKAGE_NAME = 'gradio'
class TestSketchpad(unittest.TestCase):
def test_path_exists(self):
inp = inputs.Sketchpad()
path = inputs.BASE_INPUT_INTERFACE_JS_PATH.format(inp.get_name())
path = inputs.BASE_INPUT_INTERFACE_JS_PATH.format(inp.__class__.__name__)
self.assertTrue(os.path.exists(os.path.join(PACKAGE_NAME, path)))
def test_preprocessing(self):
@ -23,7 +23,7 @@ class TestSketchpad(unittest.TestCase):
class TestWebcam(unittest.TestCase):
def test_path_exists(self):
inp = inputs.Webcam()
path = inputs.BASE_INPUT_INTERFACE_JS_PATH.format(inp.get_name())
path = inputs.BASE_INPUT_INTERFACE_JS_PATH.format(inp.__class__.__name__)
self.assertTrue(os.path.exists(os.path.join(PACKAGE_NAME, path)))
def test_preprocessing(self):
@ -35,7 +35,7 @@ class TestWebcam(unittest.TestCase):
class TestTextbox(unittest.TestCase):
def test_path_exists(self):
inp = inputs.Textbox()
path = inputs.BASE_INPUT_INTERFACE_JS_PATH.format(inp.get_name())
path = inputs.BASE_INPUT_INTERFACE_JS_PATH.format(inp.__class__.__name__)
self.assertTrue(os.path.exists(os.path.join(PACKAGE_NAME, path)))
def test_preprocessing(self):
@ -46,17 +46,17 @@ class TestTextbox(unittest.TestCase):
class TestImageUpload(unittest.TestCase):
def test_path_exists(self):
inp = inputs.ImageIn()
path = inputs.BASE_INPUT_INTERFACE_JS_PATH.format(inp.get_name())
inp = inputs.Image()
path = inputs.BASE_INPUT_INTERFACE_JS_PATH.format(inp.__class__.__name__)
self.assertTrue(os.path.exists(os.path.join(PACKAGE_NAME, path)))
def test_preprocessing(self):
inp = inputs.ImageIn()
inp = inputs.Image()
array = inp.preprocess(BASE64_IMG)
self.assertEqual(array.shape, (224, 224, 3))
def test_preprocessing(self):
inp = inputs.ImageIn()
inp = inputs.Image()
inp.image_height = 48
inp.image_width = 48
array = inp.preprocess(BASE64_IMG)

View File

@ -13,7 +13,7 @@ class TestInterface(unittest.TestCase):
self.assertIsInstance(io.output_interfaces[0], gradio.outputs.Textbox)
def test_input_interface_is_instance(self):
inp = gradio.inputs.ImageIn()
inp = gradio.inputs.Image()
io = gr.Interface(inputs=inp, outputs='textBOX', fn=lambda x: x)
self.assertEqual(io.input_interfaces[0], inp)

View File

@ -11,7 +11,7 @@ BASE64_IMG = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAYEBQYFBAY
class TestLabel(unittest.TestCase):
def test_path_exists(self):
out = outputs.Label()
path = outputs.BASE_OUTPUT_INTERFACE_JS_PATH.format(out.get_name())
path = outputs.BASE_OUTPUT_INTERFACE_JS_PATH.format(out.__class__.__name__)
self.assertTrue(os.path.exists(os.path.join(PACKAGE_NAME, path)))
# def test_postprocessing_string(self):
@ -50,7 +50,7 @@ class TestLabel(unittest.TestCase):
class TestTextbox(unittest.TestCase):
def test_path_exists(self):
out = outputs.Textbox()
path = outputs.BASE_OUTPUT_INTERFACE_JS_PATH.format(out.get_name())
path = outputs.BASE_OUTPUT_INTERFACE_JS_PATH.format(out.__class__.__name__)
self.assertTrue(os.path.exists(os.path.join(PACKAGE_NAME, path)))
def test_postprocessing(self):
@ -63,7 +63,7 @@ class TestTextbox(unittest.TestCase):
class TestImage(unittest.TestCase):
def test_path_exists(self):
out = outputs.Image()
path = outputs.BASE_OUTPUT_INTERFACE_JS_PATH.format(out.get_name())
path = outputs.BASE_OUTPUT_INTERFACE_JS_PATH.format(out.__class__.__qualname__)
self.assertTrue(os.path.exists(os.path.join(PACKAGE_NAME, path)))
def test_postprocessing(self):