mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-10-29 13:20:48 +08:00
Rename tests to python_tests
This commit is contained in:
1 parent
32c3a97650
commit
daaf106dcb
5 files changed
No files matched your search
@@ -0,0 +1,28 @@
|
||||
from unittest import TestCase
|
||||
|
||||
from optuna_dashboard.serializer import serialize_attrs
|
||||
|
||||
|
||||
class SerializeAttrsTestCase(TestCase):
|
||||
def test_serialize_bytes(self) -> None:
|
||||
serialized = serialize_attrs({"bytes": b"This is a bytes object."})
|
||||
self.assertEqual(serialized[0]["value"], "<binary object>")
|
||||
|
||||
def test_serialize_string(self) -> None:
|
||||
for length in [1000, 1024, 1100]:
|
||||
with self.subTest(f"length: {length}"):
|
||||
value = "a" * length
|
||||
serialized = serialize_attrs(
|
||||
{
|
||||
"key": value,
|
||||
}
|
||||
)
|
||||
self.assertLessEqual(len(serialized[0]["value"]), 1024)
|
||||
|
||||
def test_serialize_dict(self) -> None:
|
||||
serialized = serialize_attrs(
|
||||
{
|
||||
"key": {"foo": "bar"},
|
||||
}
|
||||
)
|
||||
self.assertLessEqual(len(serialized), 1)
|
||||
Reference in new issue
Block a user