GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — sqlobject/sqlobject/tests/test_delete.py at master · sqlobject/sqlobject Expand file tree/ Copy pathtest_delete.pyMore file actions 74 lines (50 loc) · 1.79 KB / Copy pathtest_delete.pyFile metadata and controls74 lines (50 loc) · 1.79 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 from sqlobject import OR, RelatedJoin, SQLObject, StringCol, cache from sqlobject.tests.dbtest import setupClass from .test_basic import SOTestSO1, setupGetters ######################################## # Delete during select ######################################## def testSelect(): setupGetters(SOTestSO1) for obj in SOTestSO1.select('all'): obj.destroySelf() assert list(SOTestSO1.select('all')) == [] ######################################## # Delete many rows at once ######################################## def testDeleteMany(): setupGetters(SOTestSO1) SOTestSO1.deleteMany(OR(SOTestSO1.q.name == "bob", SOTestSO1.q.name == "fred")) assert len(list(SOTestSO1.select('all'))) == 2 def testDeleteBy(): setupGetters(SOTestSO1) SOTestSO1.deleteBy(name="dave") assert len(list(SOTestSO1.select())) == 3 ######################################## # Delete without caching ######################################## class NoCache(SQLObject): name = StringCol() def testDestroySelf(): setupClass(NoCache) old = NoCache._connection.cache NoCache._connection.cache = cache.CacheSet(cache=False) value = NoCache(name='test') value.destroySelf() NoCache._connection.cache = old ######################################## # Delete from related joins ######################################## class Service(SQLObject): groups = RelatedJoin("ServiceGroup") class ServiceGroup(SQLObject): services = RelatedJoin("Service") def testDeleteRelatedJoins(): setupClass([Service, ServiceGroup]) service = Service() service_group = ServiceGroup() service.addServiceGroup(service_group) service.destroySelf() service_group = ServiceGroup.get(service_group.id) assert len(service_group.services) == 0 |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |