-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a21f1e3
commit 5a14092
Showing
5 changed files
with
70 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import unittest | ||
import json | ||
|
||
import kraken | ||
import dataclasses | ||
|
||
from pathlib import Path | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# -*- coding: utf-8 -*- | ||
import shutil | ||
import unittest | ||
import tempfile | ||
|
||
from pathlib import Path | ||
|
||
from kraken import repo | ||
|
||
thisfile = Path(__file__).resolve().parent | ||
resources = thisfile / 'resources' | ||
|
||
class TestRepo(unittest.TestCase): | ||
""" | ||
Testing interaction with the model repository. | ||
""" | ||
|
||
def setUp(self): | ||
self.temp_model = tempfile.TemporaryDirectory() | ||
self.temp_path = Path(self.temp_model.name) | ||
|
||
def tearDown(self): | ||
shutil.rmtree(self.temp_model.name) | ||
|
||
def test_listing(self): | ||
""" | ||
Tests fetching the model list. | ||
""" | ||
records = repo.get_listing() | ||
self.assertGreater(len(records), 15) | ||
|
||
def test_get_description(self): | ||
""" | ||
Tests fetching the description of a model. | ||
""" | ||
record = repo.get_description('10.5281/zenodo.6657809') | ||
self.assertEqual(record['doi'], '10.5281/zenodo.6657809') | ||
|
||
def test_get_model(self): | ||
""" | ||
Tests fetching a model. | ||
""" | ||
id = repo.get_model('10.5281/zenodo.6657809', | ||
path=self.temp_model.name) | ||
self.assertEqual(id, 'HTR-United-Manu_McFrench.mlmodel') | ||
self.assertEqual((self.temp_path / id).stat().st_size, 16176844) |