Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0
This repository has been archived on 2024-07-04. You can view files and clone it, but cannot push or open issues or pull requests.
laydi/test/system/datasettest.py

36 lines
1.1 KiB
Python
Raw Normal View History

2006-04-17 00:57:50 +02:00
import unittest
import sys
sys.path.append('../../system')
from dataset import *
from scipy import rand,shape
class DatasetTest(unittest.TestCase):
2006-04-17 00:57:50 +02:00
def setUp(self):
dim_0_ids = ('sample_a','sample_b')
dim_1_ids = ('gene_a','gene_b','gene_c')
dim_labels = ('samples','genes')
identifiers= [(dim_labels[0],dim_0_ids),(dim_labels[1],dim_1_ids)]
2006-04-17 00:57:50 +02:00
self.array = rand(2,3)
self.testdata = Dataset(self.array,identifiers)
2006-04-17 00:57:50 +02:00
def testCreation(self):
data = self.testdata
assert data._array == self.array
assert 'sample_a' in data['samples'].keys()
assert data['samples']['sample_b']==1
assert 'gene_c' in data['genes'].keys()
assert data['genes']['gene_c']==2
2006-04-17 00:57:50 +02:00
#def testExtraction(self):
# ids = ['gene_a','gene_b']
# dim_name = 'genes'
# subset = self.testdata.extract_data(ids,dim_name)
# assert shape(subset._data) == (2,2)
# assert subset.ids[dim_name].keys() == ids
# assert subset.ids[dim_name].values() == [0,1]
2006-04-17 00:57:50 +02:00
if __name__ == '__main__':
unittest.main()