-
Notifications
You must be signed in to change notification settings - Fork 179
Closed
Description
Noticed fakeredis does not support "del" operator, i.e. it does not implement __delitem__ , while real redis does.
So code like this works on real redis:
import redis
r = redis.StrictRedis(host='localhost', port=6379, db=0)
r['foo'] = 'bar'
print (r['foo']) #bar
del r['foo']
print (r['foo']) #KeyError: 'foo'but fails on fakeredis:
import fakeredis
r = fakeredis.FakeStrictRedis()
r['foo'] = 'bar'
print (r['foo']) #bar
del r['foo'] #AttributeError: __delitem__
#r.delete('foo') #this would workMy guess on this is that even if __delitem__ is there in _StrKeyDict, because of name mangling, this happens.
If there's interest in getting this fixed, I can probably do a clean enough PR.
Metadata
Metadata
Assignees
Labels
No labels