source: orange-bioinformatics/_bioinformatics/tests/test_ontology.py @ 1742:fa3a9e4af7e6

Revision 1742:fa3a9e4af7e6, 1.3 KB checked in by Ales Erjavec <ales.erjavec@…>, 12 months ago (diff)

Code style and docstring fixes.

Line 
1import doctest
2import unittest
3from StringIO import StringIO
4
5from .. import obiOntology as ontology
6
7
8class TestOntology(unittest.TestCase):
9    def test_oboobject(self):
10        stanza = '''[Term]
11id: FOO:001
12name: bar
13'''
14        term = ontology.OBOObject.parse_stanza(stanza)
15
16#        self.assertEqual(term.get_value("id"), "FOO:001")
17#        self.assertEqual(term.get_value("name"), "bar")
18
19        term.add_tag("tt", "3")
20
21    def test_ontology(self):
22        seinfeld = StringIO("""
23[Typedef]
24id: parent
25
26[Typedef]
27id: child
28inverse_of: parent ! not actually used yet
29
30[Term]
31id: 001
32name: George
33
34[Term]
35id: 002
36name: Estelle
37relationship: parent 001 ! George
38
39[Term]
40id: 003
41name: Frank
42relationship: parent 001 ! George
43
44""")  # TODO: fill the ontology with all characters
45        stanza = '''[Term]
46id: FOO:001
47name: bar
48'''
49#        term = ontology.OBOObject.parse_stanza(stanza)
50
51        seinfeld = ontology.OBOOntology(seinfeld)
52#        print seinfeld.child_edges("001")
53
54def load_tests(loader, tests, ignore):
55    stanza = '''[Term]
56id: FOO:001
57name: bar
58'''
59    term = ontology.OBOObject.parse_stanza(stanza)
60    tests.addTests(doctest.DocTestSuite(ontology,
61                                        extraglobs={"term": term},
62                                        optionflags=doctest.ELLIPSIS))
63    return tests
Note: See TracBrowser for help on using the repository browser.