-
Notifications
You must be signed in to change notification settings - Fork 254
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(core): model digest calculation test (#421)
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |