Merge pull request #376 from AK391/master

add test for capture session
This commit is contained in:
Abubakar Abid 2021-11-19 00:31:05 -06:00 committed by GitHub
commit 868b49463f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -229,8 +229,15 @@ class TestInterface(unittest.TestCase):
interface.integrate(mlflow=mlflow)
mock_post.assert_called_once()
def test_capture_session(self):
interface = Interface(lambda x: x, "textbox", "label", capture_session=True, interpretation=lambda x: 0)
interface.session = (mock.MagicMock(), mock.MagicMock())
interface.interpret(["quickest brown fox"])
interface.session[0].as_default.assert_called_once()
interface.session[1].as_default.assert_called_once()
interface.run_prediction(["quickest brown fox"])
self.assertEqual(interface.session[0].as_default.call_count, 2)
self.assertEqual(interface.session[1].as_default.call_count, 2)
if __name__ == '__main__':
unittest.main()