2006-04-17 00:06:29 +02:00
|
|
|
|
|
|
|
import unittest
|
|
|
|
import sys
|
|
|
|
sys.path.append('../../system')
|
|
|
|
from annotations import *
|
2006-04-17 01:30:01 +02:00
|
|
|
from sets import Set as set
|
2006-04-17 00:06:29 +02:00
|
|
|
|
|
|
|
class AnnotationTest(unittest.TestCase):
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def testCreation(self):
|
|
|
|
a = Annotations('x', 'y')
|
2006-04-17 01:30:01 +02:00
|
|
|
|
2006-04-17 00:06:29 +02:00
|
|
|
assert a.has_dimension('x')
|
|
|
|
assert a.has_dimension('y')
|
|
|
|
assert not a.has_dimension('z')
|
|
|
|
|
2006-04-17 01:30:01 +02:00
|
|
|
def testAddAnnotations(self):
|
|
|
|
ann = Annotations('genes', 'go')
|
|
|
|
go = set(['GO:0', 'GO:1'])
|
|
|
|
ann.add_annotations('genes', 'BadGene', 'go', go)
|
|
|
|
genes = set(['BadGene'])
|
|
|
|
|
|
|
|
assert ann.get_annotations('genes', 'BadGene', 'go') == go
|
|
|
|
assert ann.get_annotations('go', 'GO:0', 'genes') == genes
|
|
|
|
assert ann.get_annotations('go', 'GO:1', 'genes') == genes
|
|
|
|
assert ann.get_annotations('go', 'GO:2', 'genes') == set()
|
|
|
|
|
2006-04-17 00:06:29 +02:00
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|