Source code for sqlobject.tests.test_class_hash
from sqlobject import SQLObject, StringCol
from sqlobject.tests.dbtest import setupClass
########################################
# Test hashing a column instance
########################################
[docs]class ClassHashTest(SQLObject):
name = StringCol(length=50, alternateID=True, dbName='name_col')
[docs]def test_class_hash():
setupClass(ClassHashTest)
ClassHashTest(name='bob')
b = ClassHashTest.byName('bob')
hashed = hash(b)
b.expire()
b = ClassHashTest.byName('bob')
assert hash(b) == hashed