Skip to content

Instantly share code, notes, and snippets.

@VakarisZ

VakarisZ/gib.py Secret

Created Oct 22, 2019
Embed
What would you like to do?
Ring bug
from bson import ObjectId
import ring
oid1 = ObjectId('cafecafecafecafecafecafe')
oid2 = ObjectId('cafacafacafacafacafacafa')
oidx = ObjectId('cafecafecafecafecafecafe')
assert oid1 == oidx
assert oid1 is not oidx
assert oid1 != oid2
class Test:
@ring.lru()
@staticmethod
def f(oid):
print('caching:', oid)
return oid
assert Test.f(oid1) is oid1
assert Test.f(oid2) is oid2
assert Test.f(oidx) is oid1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment