source: orange-bioinformatics/_bioinformatics/obiKEGG/tests/test_entry.py @ 1736:b3b664abcfdd

Revision 1736:b3b664abcfdd, 1.0 KB checked in by Ales Erjavec <ales.erjavec@…>, 13 months ago (diff)

Added sphinx rst documentation for obiKEGG.

RevLine 
[1736]1from StringIO import StringIO
2import doctest
3
4import unittest
5
6from ..entry import parser, fields, DBEntry, entry_decorate
7
8
9TEST_ENTRY = """\
10ENTRY       test_id    something else
11NAME        test
12DESCRIPTION This is a test's description.
13            it spans
14            multiple lines
15  SUB       This is a description's sub
16            section
17///
18"""
19
20
21@entry_decorate
22class Entry(DBEntry):
23    pass
24
25
26class TestEntry(unittest.TestCase):
27    def test_entry(self):
28        """
29        Test basic DBEntry class.
30        """
31        entry = Entry(TEST_ENTRY)
32        self.assertEqual(entry.entry_key, "test_id")
33        self.assertEqual(entry.ENTRY.TITLE, "ENTRY")
34
35        self.assertEqual(str(entry), TEST_ENTRY[:-4])
36
37
38class TestParser(unittest.TestCase):
39    def test_parser(self):
40        parse = parser.DBGETEntryParser()
41        stream = StringIO(TEST_ENTRY)
42
43        for event, title, text in parse.parse(stream):
44            pass
45
46
47def load_tests(loader, tests, ignore):
48    tests.addTests(doctest.DocTestSuite(parser))
49    return tests
Note: See TracBrowser for help on using the repository browser.