Esempio n. 1
0
 def flush(self):
     CachedDOData.flush(self)
     self._flushed = True
Esempio n. 2
0
 def __init__(self):
     CachedDOData.__init__(self)
     self._destroyed = False
     self._flushed = False
Esempio n. 3
0
 def destroy(self):
     CachedDOData.destroy(self)
     self._destroyed = True
Esempio n. 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
Esempio n. 5
0
 def flush(self):
     CachedDOData.flush(self)
     self._flushed = True
Esempio n. 6
0
 def destroy(self):
     CachedDOData.destroy(self)
     self._destroyed = True
Esempio n. 7
0
 def __init__(self):
     CachedDOData.__init__(self)
     self._destroyed = False
     self._flushed = False
Esempio n. 8
0
    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