def test_getitem_missing(self):
     pd = PersistentDict()
     with pytest.raises(KeyError):
         pd.getitem("abc")
     pd = pd.setitem("abc", 10)
     with pytest.raises(KeyError):
         pd.getitem("def")
 def test_setitem_hash_collision(self):
     pd = PersistentDict().setitem(HashKey(0, "a"), 10).setitem(HashKey(0, "b"), 20).setitem(HashKey(0, "c"), 30).setitem(HashKey(0, "a"), 10)
     assert pd.getitem(HashKey(0, "a")) == 10
     assert pd.getitem(HashKey(0, "b")) == 20
     assert pd.getitem(HashKey(0, "c")) == 30
     with pytest.raises(KeyError):
         pd.getitem(HashKey(0, "d"))
 def test_none_key(self):
     pd = PersistentDict()
     with pytest.raises(KeyError):
         pd.getitem(None)
     pd = pd.setitem(None, 3)
     assert pd.getitem(None) == 3
     pd = pd.setitem(None, 3)
     assert pd.getitem(None) == 3
     pd = pd.delitem(None)
     with pytest.raises(KeyError):
         pd.delitem(None)
 def test_getitem(self):
     pd = PersistentDict()
     pd = pd.setitem("abc", 3)
     assert pd.getitem("abc") == 3
 def test_setitem_same_value(self):
     pd = PersistentDict().setitem("abc", 3).setitem("abc", 3)
     assert pd.getitem("abc") == 3
 def test_setitem_same_key(self):
     pd = PersistentDict().setitem("abc", 3).setitem("abc", 10)
     assert pd.getitem("abc") == 10
 def test_setitem_same_key(self):
     pd = PersistentDict().setitem("abc", 3).setitem("abc", 10)
     assert pd.getitem("abc") == 10