Beispiel #1
0
def test_remove_file():
    i = Index()
    i.insert(id='1', age=65, path='test.txt', type='txt')
    i.insert(id='1', path='test1.txt', type='txt')
    assert len(i.datasets) == 1
    dataset = i.datasets.get('1')
    assert len(dataset) == 2
    i.remove(path='test.txt')
    assert len(i.datasets) == 1
    assert len(i.datasets.get('1')) == 1
Beispiel #2
0
def test_replicates_w_metadata():
    """Test merged datasets with metadata"""
    i = Index('test/data/index.txt')
    i.set_format('test/data/format.json')
    i.open()
    i.insert(id='aWL3.1,aWL3.2',
             path='test/data/format.json',
             type='json',
             view='json')
    i.lookup(id='aWL3.1,aWL3.2')
    i.remove(path='test/data/format.json', clear=True)
Beispiel #3
0
def test_remove_fileinfo():
    i = Index()
    i.insert(id='1', age=65, path='test.txt', type='txt')
    i.insert(id='1', path='test1.txt', type='txt')
    i.insert(id='1', path='test1.jpg', type='jpeg')
    assert len(i.datasets) == 1
    dataset = i.datasets.get('1')
    assert len(dataset) == 3
    i.remove(type='jpeg')
    print i.datasets.get('1')._files
    assert len(i.datasets) == 1
    assert len(i.datasets.get('1')) == 2
Beispiel #4
0
def test_remove_dataset():
    i = Index()
    i.insert(id='1', age=65, path='test.txt', type='txt')
    i.remove(id='1')
    assert len(i.datasets) == 0