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_learnware.py 957 B

1234567891011121314151617181920212223
  1. import os
  2. import zipfile
  3. import tempfile
  4. from learnware.learnware import get_learnware_from_dirpath
  5. from learnware.test import get_semantic_specification
  6. from learnware.client.container import LearnwaresContainer
  7. from learnware.market import EasyMarket
  8. if __name__ == "__main__":
  9. semantic_specification = get_semantic_specification()
  10. zip_path = "rf_tic.zip"
  11. with tempfile.TemporaryDirectory(suffix="learnware") as tempdir:
  12. learnware_dirpath = os.path.join(tempdir, "test")
  13. with zipfile.ZipFile(zip_path, "r") as z_file:
  14. z_file.extractall(learnware_dirpath)
  15. learnware = get_learnware_from_dirpath(
  16. id="test", semantic_spec=semantic_specification, learnware_dirpath=learnware_dirpath
  17. )
  18. with LearnwaresContainer(learnware, zip_path) as env_container:
  19. learnware = env_container.get_learnwares_with_container()[0]
  20. print(EasyMarket.check_learnware(learnware))