MCPcopy Create free account
hub / github.com/cdgriffith/Box / test_hashing

Method test_hashing

test/test_box.py:596–608  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

594 assert json.loads(bx.to_json()) == {"a": [{"b": 123}, {"b": 222}], "c": [[{"d": 2}], [3, 4]]}
595
596 def test_hashing(self):
597 bx1 = Box(t=3, g=4, frozen_box=True)
598 bx2 = Box(g=4, t=3, frozen_box=True)
599 assert hash(bx1) == hash(bx2)
600
601 bl1 = BoxList([1, 2, 3, 4], frozen_box=True)
602 bl2 = BoxList([1, 2, 3, 4], frozen_box=True)
603 bl3 = BoxList([2, 1, 3, 4], frozen_box=True)
604 assert hash(bl2) == hash(bl1)
605 assert hash(bl3) != hash(bl2)
606
607 with pytest.raises(TypeError):
608 hash(BoxList([1, 2, 3]))
609
610 def test_config(self):
611 bx = Box(extended_test_dict)

Callers

nothing calls this directly

Calls 2

BoxClass · 0.90
BoxListClass · 0.90

Tested by

no test coverage detected