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)
def test_lookup_full_index(): """Test export""" i = Index('test/data/index.txt') assert i is not None i.set_format('test/data/format.json') i.open() result = i.lookup(type='gtf') assert result.export()[0][0] != '.'
def test_lookup_more_types_index_id(): """Test export""" i = Index('test/data/index_gfs.txt') assert i is not None i.set_format('test/data/format.json') i.open() result = i.lookup(id='WWP.1') assert result.export()[0][0] != '.'
def test_lookup_multiple_or(): i = Index() i.insert(id='1', age=65, path='test1.txt', type='txt') i.insert(id='2', age=63, path='test2.txt', type='txt') i.insert(id='3', age=70, path='test3.jpg', type='jpg') i.insert(id='4', age=45, path='test4.pdf', type='pdf') selected = i.lookup(type='txt', path='test3.jpg', or_query=True) assert selected.datasets != i.datasets assert len(selected.datasets) == 3
def test_lookup_more_types_index(): """Test export""" i = Index('test/data/index_one_gfs.txt') assert i is not None i.set_format('test/data/format.json') i.open() result = i.lookup(type='gtf') assert result != None assert result.datasets != {} assert result.export()[0][0] != '.'
def test_lookup_simple_dataset(): i = Index() i.insert(id='1', age=65, path='test.txt', type='txt') selected = i.lookup(id='1') assert selected.datasets == i.datasets dataset = selected.datasets.get('1') assert dataset is not None assert dataset.id == '1' assert dataset.age == 65 assert len(dataset) == 1
def test_lookup_no_path(): i = Index('test/data/index.txt') i.set_format('test/data/format.json') i.open() assert i.datasets.get('WLP.2') is not None selected = i.lookup(id='WLP.2') assert selected.datasets != i.datasets assert len(selected.datasets) == 1 dataset = selected.datasets.get('WLP.2') assert dataset is not None dataset.id = 'WLP.2'
def test_lookup_path(): i = Index() i.insert(id='1', age=65, path='test1.txt', type='txt') i.insert(id='2', age=63, path='test2.txt', type='txt') i.insert(id='3', age=70, path='test3.jpg', type='jpg') selected = i.lookup(path='test3.jpg') assert selected.datasets != i.datasets dataset = selected.datasets.get('3') assert dataset is not None assert dataset.id == '3' assert dataset.age == 70 assert len(dataset) == 1
def test_lookup_multiple_or(): i = Index() i.insert(id='1', age=65, path='test1.txt', type='txt') i.insert(id='1', age=65, path='test1.gff', type='gff') selected = i.lookup(type='txt') assert len(selected.datasets.values()[0]) == 1