コード例 #1
0
def test_foo():
    # start fresh
    rmtree('foo', ignore_errors=True)

    d = dir_archive('foo', cached=False)
    key = '1234TESTMETESTMETESTME1234'
    d._mkdir(key)
    #XXX: repeat mkdir does nothing, should it clear?  I think not.
    _dir = d._mkdir(key)
    assert d._getdir(key) == _dir
    d._rmdir(key)

    # with _pickle
    x = [1,2,3,4,5]
    d._fast = True
    d[key] = x
    assert d[key] == x
    d._rmdir(key)

    # with dill
    d._fast = False
    d[key] = x
    assert d[key] == x
    d._rmdir(key)

    # with import
    d._serialized = False
    d[key] = x
    assert d[key] == x
    d._rmdir(key)
    d._serialized = True

    try: 
        import numpy as np
        y = np.array(x)

        # with _pickle
        d._fast = True
        d[key] = y
        assert all(d[key] == y)
        d._rmdir(key)

        # with dill
        d._fast = False
        d[key] = y
        assert all(d[key] == y)
        d._rmdir(key)

        # with import
        d._serialized = False
        d[key] = y
        assert all(d[key] == y)
        d._rmdir(key)
        d._serialized = True

    except ImportError:
        pass

    # clean up
    rmtree('foo')
コード例 #2
0
def test_archive():
    # try some of the different __init__
    archive = dir_archive(cached=False)
    check_basic(archive)
    check_numpy(archive)
    #rmtree('memo')

    archive = dir_archive(cached=False,fast=True)
    check_basic(archive)
    check_numpy(archive)
    #rmtree('memo')

    archive = dir_archive(cached=False,compression=3)
    check_basic(archive)
    check_numpy(archive)
    #rmtree('memo')

    archive = dir_archive(cached=False,memmode='r+')
    check_basic(archive)
    check_numpy(archive)
    #rmtree('memo')

    archive = dir_archive(cached=False,serialized=False)
    check_basic(archive)
    check_numpy(archive)
    rmtree('memo')
コード例 #3
0
def test_foo():
    # start fresh
    rmtree('foo', ignore_errors=True)

    d = dir_archive('foo', cached=False)
    key = '1234TESTMETESTMETESTME1234'
    d._mkdir(key)
    #XXX: repeat mkdir does nothing, should it clear?  I think not.
    _dir = d._mkdir(key)
    assert d._getdir(key) == _dir
    d._rmdir(key)

    # with _pickle
    x = [1, 2, 3, 4, 5]
    d._fast = True
    d[key] = x
    assert d[key] == x
    d._rmdir(key)

    # with dill
    d._fast = False
    d[key] = x
    assert d[key] == x
    d._rmdir(key)

    # with import
    d._serialized = False
    d[key] = x
    assert d[key] == x
    d._rmdir(key)
    d._serialized = True

    try:
        import numpy as np
        y = np.array(x)

        # with _pickle
        d._fast = True
        d[key] = y
        assert all(d[key] == y)
        d._rmdir(key)

        # with dill
        d._fast = False
        d[key] = y
        assert all(d[key] == y)
        d._rmdir(key)

        # with import
        d._serialized = False
        d[key] = y
        assert all(d[key] == y)
        d._rmdir(key)
        d._serialized = True

    except ImportError:
        pass

    # clean up
    rmtree('foo')
コード例 #4
0
def test_archive():
    # try some of the different __init__
    archive = dir_archive(cached=False)
    check_basic(archive)
    check_numpy(archive)
    #rmtree('memo')

    archive = dir_archive(cached=False, fast=True)
    check_basic(archive)
    check_numpy(archive)
    #rmtree('memo')

    archive = dir_archive(cached=False, compression=3)
    check_basic(archive)
    check_numpy(archive)
    #rmtree('memo')

    archive = dir_archive(cached=False, memmode='r+')
    check_basic(archive)
    check_numpy(archive)
    #rmtree('memo')

    archive = dir_archive(cached=False, serialized=False)
    check_basic(archive)
    #check_numpy(archive) #FIXME: see issue #53
    rmtree('memo')
コード例 #5
0
ファイル: test_frame.py プロジェクト: uqfoundation/klepto
def _cleanup():
    import os
    import pox
    try: os.remove('foo.pkl')
    except: pass
    try: os.remove('foo.h5')
    except: pass
    try: pox.rmtree('foo')
    except: pass
    try: pox.rmtree('bar')
    except: pass
    return
コード例 #6
0
def _cleanup():
    import os
    import pox
    try: os.remove('foo.pkl')
    except: pass
    try: os.remove('foo.h5')
    except: pass
    try: pox.rmtree('foo')
    except: pass
    try: pox.rmtree('bar')
    except: pass
    return
コード例 #7
0
ファイル: test_basic.py プロジェクト: briandrawert/klepto
def _cleanup():
    import os
    import pox
    try: os.remove('memo.pkl')
    except: pass
    try: os.remove('xxxx.pkl')
    except: pass
    try: os.remove('memo.py')
    except: pass
    try: os.remove('memo.pyc')
    except: pass
    try: os.remove('memo.pyo')
    except: pass
    try: os.remove('memo.pyd')
    except: pass
    try: os.remove('xxxx.py')
    except: pass
    try: os.remove('xxxx.pyc')
    except: pass
    try: os.remove('xxxx.pyo')
    except: pass
    try: os.remove('xxxx.pyd')
    except: pass
    try: os.remove('memo.db')
    except: pass
    try: pox.rmtree('memoi')
    except: pass
    try: pox.rmtree('memoj')
    except: pass
    try: pox.rmtree('memom')
    except: pass
    try: pox.rmtree('memop')
    except: pass
    try: pox.rmtree('memoz')
    except: pass
    return
コード例 #8
0
ファイル: test_hdf.py プロジェクト: koreiter/klepto
def _cleanup():
    import os
    import pox
    try: os.remove('memo.hdf5')
    except: pass
    try: os.remove('xxxx.hdf5')
    except: pass
    try: os.remove('memo.h5')
    except: pass
    try: os.remove('xxxx.h5')
    except: pass
    try: pox.rmtree('memoq')
    except: pass
    try: pox.rmtree('memor')
    except: pass
    try: pox.rmtree('memos')
    except: pass
    try: pox.rmtree('memot')
    except: pass
    return
コード例 #9
0
ファイル: test_hdf.py プロジェクト: uqfoundation/klepto
def _cleanup():
    import os
    import pox
    try: os.remove('memo.hdf5')
    except: pass
    try: os.remove('xxxx.hdf5')
    except: pass
    try: os.remove('memo.h5')
    except: pass
    try: os.remove('xxxx.h5')
    except: pass
    try: pox.rmtree('memoq')
    except: pass
    try: pox.rmtree('memor')
    except: pass
    try: pox.rmtree('memos')
    except: pass
    try: pox.rmtree('memot')
    except: pass
    return
コード例 #10
0
def _cleanup():
    import pox
    try:
        pox.rmtree('cache_class')
    except:
        pass
コード例 #11
0
#!/usr/bin/env python
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Copyright (c) 2013-2015 California Institute of Technology.
# License: 3-clause BSD.  The full license text is available at:
#  - http://trac.mystic.cacr.caltech.edu/project/pathos/browser/klepto/LICENSE

from klepto.archives import dir_archive
from pox import rmtree

# start fresh
rmtree('foo', ignore_errors=True)

d = dir_archive('foo', cached=False)
key = '1234TESTMETESTMETESTME1234'
d._mkdir(key)
#XXX: repeat mkdir does nothing, should it clear?  I think not.
_dir = d._mkdir(key)
assert d._getdir(key) == _dir
d._rmdir(key)

# with _pickle
x = [1, 2, 3, 4, 5]
d._fast = True
d[key] = x
assert d[key] == x
d._rmdir(key)

# with dill
d._fast = False
d[key] = x
コード例 #12
0
def _cleanup():
    import os
    import pox
    try:
        os.remove('memo.pkl')
    except:
        pass
    try:
        os.remove('xxxx.pkl')
    except:
        pass
    try:
        os.remove('memo.py')
    except:
        pass
    try:
        os.remove('memo.pyc')
    except:
        pass
    try:
        os.remove('memo.pyo')
    except:
        pass
    try:
        os.remove('memo.pyd')
    except:
        pass
    try:
        os.remove('xxxx.py')
    except:
        pass
    try:
        os.remove('xxxx.pyc')
    except:
        pass
    try:
        os.remove('xxxx.pyo')
    except:
        pass
    try:
        os.remove('xxxx.pyd')
    except:
        pass
    try:
        os.remove('memo.db')
    except:
        pass
    try:
        pox.rmtree('memoi')
    except:
        pass
    try:
        pox.rmtree('memoj')
    except:
        pass
    try:
        pox.rmtree('memom')
    except:
        pass
    try:
        pox.rmtree('memop')
    except:
        pass
    try:
        pox.rmtree('memoz')
    except:
        pass
    return
コード例 #13
0
ファイル: test_readwrite.py プロジェクト: RaoUmer/klepto
#!/usr/bin/env python
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Copyright (c) 2013-2015 California Institute of Technology.
# License: 3-clause BSD.  The full license text is available at:
#  - http://trac.mystic.cacr.caltech.edu/project/pathos/browser/klepto/LICENSE

from klepto.archives import dir_archive
from pox import rmtree

# start fresh
rmtree('foo', ignore_errors=True)


d = dir_archive('foo', cached=False)
key = '1234TESTMETESTMETESTME1234'
d._mkdir(key)
#XXX: repeat mkdir does nothing, should it clear?  I think not.
_dir = d._mkdir(key)
assert d._getdir(key) == _dir
d._rmdir(key)

# with _pickle
x = [1,2,3,4,5]
d._fast = True
d[key] = x
assert d[key] == x
d._rmdir(key)

# with dill
d._fast = False