Add ArtifactNotFound exception

This commit is contained in:
c-bata
2023-06-02 18:02:55 +09:00
parent 1f79649cb1
commit 9646f6367e
7 changed files with 101 additions and 7 deletions
@@ -3,6 +3,7 @@ import tempfile
from unittest import TestCase
from optuna_dashboard.artifact.file_system import FileSystemBackend
from optuna_dashboard.artifact.exceptions import ArtifactNotFound
class FileSystemBackendTestCase(TestCase):
@@ -20,3 +21,10 @@ class FileSystemBackendTestCase(TestCase):
with backend.open(artifact_id) as f:
actual = f.read()
self.assertEqual(actual, dummy_content)
def test_file_not_found(self) -> None:
backend = FileSystemBackend(self.dir.name)
with self.assertRaises(ArtifactNotFound):
backend.open("not-found-id")
with self.assertRaises(ArtifactNotFound):
backend.remove("not-found-id")