You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_check_requirements.py 636 B

12345678910111213141516171819202122
  1. # Copyright (c) Alibaba, Inc. and its affiliates.
  2. import unittest
  3. from typing import List, Union
  4. from modelscope.utils.check_requirements import NLPModuleNotFoundError, get_msg
  5. from modelscope.utils.constant import Fields
  6. class ImportUtilsTest(unittest.TestCase):
  7. def test_type_module_not_found(self):
  8. with self.assertRaises(NLPModuleNotFoundError) as ctx:
  9. try:
  10. import not_found
  11. except ModuleNotFoundError as e:
  12. raise NLPModuleNotFoundError(e)
  13. self.assertTrue(get_msg(Fields.nlp) in ctx.exception.msg.msg)
  14. if __name__ == '__main__':
  15. unittest.main()