Skip to content

Commit

Permalink
TEST: compute hash over frozendict
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Dec 19, 2024
1 parent 8a9a171 commit a1d4c94
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ style = [
]
test = [
"ampform[scipy]",
"frozendict",
"ipywidgets", # symplot
"nbmake",
"numpy",
Expand Down
16 changes: 8 additions & 8 deletions tests/sympy/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest
import qrules
import sympy as sp
from qrules.topology import FrozenDict
from frozendict import frozendict

from ampform import get_builder
from ampform.dynamics import EnergyDependentWidth
Expand Down Expand Up @@ -100,16 +100,16 @@ def test_amplitude_model(self, expected_hash: str, formalism: SpinFormalism):

class TestFrozenDict:
def test_qrules_frozen_dict(self):
obj: FrozenDict = FrozenDict({})
assert get_readable_hash(obj) == "023f1d9cf3576a46b278007d6e5cb0fa"
obj: frozendict = frozendict({})
assert get_readable_hash(obj) == "c47e813991dc106a9eb228c8aa5f6aa5"

obj = FrozenDict({"key1": "value1"})
assert get_readable_hash(obj) == "076915d85252aa5c87f63702437c6dbd"
obj = frozendict({"key1": "value1"})
assert get_readable_hash(obj) == "6e8dcf3dc6279354d54d13751fe83f64"

obj = FrozenDict({
obj = frozendict({
"key1": "value1",
"key2": 2,
"key3": (1, 2, 3),
"key4": FrozenDict({"nested_key": "nested_value"}),
"key4": frozendict({"nested_key": "nested_value"}),
})
assert get_readable_hash(obj) == "c3b3a661e63f57003fc3deea5d23ede9"
assert get_readable_hash(obj) == "e6d0016db574753d7578e31812578227"
31 changes: 31 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a1d4c94

Please sign in to comment.