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_learnware.py 2.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import os
  2. import unittest
  3. import tempfile
  4. from learnware.client import LearnwareClient
  5. class TestCheckLearnware(unittest.TestCase):
  6. def setUp(self):
  7. unittest.TestCase.setUpClass()
  8. self.client = LearnwareClient()
  9. def test_check_learnware_pip(self):
  10. learnware_id = "00000154"
  11. with tempfile.TemporaryDirectory(prefix="learnware_") as tempdir:
  12. self.zip_path = os.path.join(tempdir, "test.zip")
  13. self.client.download_learnware(learnware_id, self.zip_path)
  14. LearnwareClient.check_learnware(self.zip_path)
  15. def test_check_learnware_conda(self):
  16. learnware_id = "00000148"
  17. with tempfile.TemporaryDirectory(prefix="learnware_") as tempdir:
  18. self.zip_path = os.path.join(tempdir, "test.zip")
  19. self.client.download_learnware(learnware_id, self.zip_path)
  20. LearnwareClient.check_learnware(self.zip_path)
  21. def test_check_learnware_dependency(self):
  22. learnware_id = "00000147"
  23. with tempfile.TemporaryDirectory(prefix="learnware_") as tempdir:
  24. self.zip_path = os.path.join(tempdir, "test.zip")
  25. self.client.download_learnware(learnware_id, self.zip_path)
  26. LearnwareClient.check_learnware(self.zip_path)
  27. def test_check_learnware_image(self):
  28. learnware_id = "00000677"
  29. with tempfile.TemporaryDirectory(prefix="learnware_") as tempdir:
  30. self.zip_path = os.path.join(tempdir, "test.zip")
  31. self.client.download_learnware(learnware_id, self.zip_path)
  32. LearnwareClient.check_learnware(self.zip_path)
  33. def test_check_learnware_text(self):
  34. learnware_id = "00000662"
  35. with tempfile.TemporaryDirectory(prefix="learnware_") as tempdir:
  36. self.zip_path = os.path.join(tempdir, "test.zip")
  37. self.client.download_learnware(learnware_id, self.zip_path)
  38. LearnwareClient.check_learnware(self.zip_path)
  39. if __name__ == "__main__":
  40. unittest.main()