mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-10 12:23:22 +08:00
Implement user API for Artifacts
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import io
|
||||
import tempfile
|
||||
from unittest import TestCase
|
||||
|
||||
from optuna_dashboard.artifact.file_system import FileSystemBackend
|
||||
|
||||
|
||||
class FileSystemBackendTestCase(TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.dir = tempfile.TemporaryDirectory()
|
||||
|
||||
def tearDown(self) -> None:
|
||||
self.dir.cleanup()
|
||||
|
||||
def test_upload_download(self) -> None:
|
||||
artifact_id = "dummy-uuid"
|
||||
dummy_content = b"Hello World"
|
||||
backend = FileSystemBackend(self.dir.name)
|
||||
backend.write(artifact_id, io.BytesIO(dummy_content))
|
||||
with backend.open(artifact_id) as f:
|
||||
actual = f.read()
|
||||
self.assertEqual(actual, dummy_content)
|
||||
Reference in New Issue
Block a user