示例#1
0
 def flush(self):
     CachedDOData.flush(self)
     self._flushed = True
示例#2
0
 def __init__(self):
     CachedDOData.__init__(self)
     self._destroyed = False
     self._flushed = False
示例#3
0
 def destroy(self):
     CachedDOData.destroy(self)
     self._destroyed = True
示例#4
0
            CachedDOData.__init__(self)
            self._destroyed = False
            self._flushed = False

        def destroy(self):
            CachedDOData.destroy(self)
            self._destroyed = True

        def flush(self):
            CachedDOData.flush(self)
            self._flushed = True

    dc = CRDataCache()
    dc._startMemLeakCheck()

    cd = CachedDOData()
    cd.foo = 34
    dc.setCachedData(1, 'testCachedData', cd)
    del cd
    cd = CachedDOData()
    cd.bar = 45
    dc.setCachedData(1, 'testCachedData2', cd)
    del cd
    assert dc.hasCachedData(1)
    assert dc.hasCachedData(1)
    assert not dc.hasCachedData(2)
    # data is dict of dataName->data
    data = dc.popCachedData(1)
    assert len(data) == 2
    assert 'testCachedData' in data
    assert 'testCachedData2' in data
 def flush(self):
     CachedDOData.flush(self)
     self._flushed = True
 def destroy(self):
     CachedDOData.destroy(self)
     self._destroyed = True
 def __init__(self):
     CachedDOData.__init__(self)
     self._destroyed = False
     self._flushed = False
    class TestCachedData(CachedDOData):
        def __init__(self):
            CachedDOData.__init__(self)
            self._destroyed = False
            self._flushed = False
        def destroy(self):
            CachedDOData.destroy(self)
            self._destroyed = True
        def flush(self):
            CachedDOData.flush(self)
            self._flushed = True

    dc = CRDataCache()
    dc._startMemLeakCheck()

    cd = CachedDOData()
    cd.foo = 34
    dc.setCachedData(1, 'testCachedData', cd)
    del cd
    cd = CachedDOData()
    cd.bar = 45
    dc.setCachedData(1, 'testCachedData2', cd)
    del cd
    assert dc.hasCachedData(1)
    assert dc.hasCachedData(1)
    assert not dc.hasCachedData(2)
    # data is dict of dataName->data
    data = dc.popCachedData(1)
    assert len(data) == 2
    assert 'testCachedData' in data
    assert 'testCachedData2' in data