Fixed UUID (and other types) serialization in the CallbackData factory. (#1602)

From now UUID will have 32 bytes length instead of 36 bytes.
This commit is contained in:
Alex Root Junior 2024-11-02 16:37:31 +02:00 committed by GitHub
parent 405bbcc36f
commit fd014d2026
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 1 deletions

View file

@ -92,6 +92,18 @@ class TestCallbackData:
assert MyCallback(foo="test", bar=42).pack() == "test:test:42"
def test_pack_uuid(self):
class MyCallbackWithUUID(CallbackData, prefix="test"):
foo: str
bar: UUID
callback = MyCallbackWithUUID(
foo="test",
bar=UUID("123e4567-e89b-12d3-a456-426655440000"),
)
assert callback.pack() == "test:test:123e4567e89b12d3a456426655440000"
def test_pack_optional(self):
class MyCallback1(CallbackData, prefix="test1"):
foo: str