import unittest import sys sys.path.append('../../system') from annotations import * from sets import Set as set class AnnotationTest(unittest.TestCase): def setUp(self): pass def testCreation(self): a = Annotations('x', 'y') assert a.has_dimension('x') assert a.has_dimension('y') assert not a.has_dimension('z') 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() if __name__ == '__main__': unittest.main()