Skip to content

Commit

Permalink
test(core): model digest calculation test (#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
Archento authored Jul 4, 2024
1 parent a023acd commit 1ba467d
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions python/tests/test_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import unittest

from uagents import Model


class TestModelDigest(unittest.TestCase):
def test_calculate_digest_backcompat(self):
"""
Test that the digest calculation is consistent with the result from
previous versions to ensure backwards compatibility.
"""

class SuperImportantCheck(Model):
"""Plus random docstring"""

check: bool
message: str
counter: int

target_digest = (
"model:21e34819ee8106722968c39fdafc104bab0866f1c73c71fd4d2475be285605e9"
)

result = Model.build_schema_digest(SuperImportantCheck)

self.assertEqual(result, target_digest, "Digest mismatch")


if __name__ == "__main__":
unittest.main()

0 comments on commit 1ba467d

Please sign in to comment.