1
|
|
|
import unittest |
2
|
|
|
import sys |
3
|
|
|
|
4
|
|
|
sys.path.insert(0, ".") |
5
|
|
|
from coalib.bearlib.languages.documentation.DocstyleDefinition import ( |
6
|
|
|
DocstyleDefinition) |
7
|
|
|
from coalib.bearlib.languages.documentation.DocumentationComment import ( |
8
|
|
|
DocumentationComment) |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
class DocumentationCommentTest(unittest.TestCase): |
12
|
|
|
def test_fields(self): |
13
|
|
|
docdef = DocstyleDefinition("C", "doxygen", (("/**", "*", "*/"),)) |
14
|
|
|
|
15
|
|
|
uut = DocumentationComment("my doc", |
16
|
|
|
docdef, |
17
|
|
|
("/**", "*", "*/"), |
18
|
|
|
(25, 45)) |
19
|
|
|
|
20
|
|
|
self.assertEqual(uut.documentation, "my doc") |
21
|
|
|
self.assertEqual(str(uut), "my doc") |
22
|
|
|
self.assertIs(uut.docstyle, docdef) |
23
|
|
|
self.assertEqual(uut.marker, ("/**", "*", "*/")) |
24
|
|
|
self.assertEqual(uut.range, (25, 45)) |
25
|
|
|
|
26
|
|
|
docdef = DocstyleDefinition("PYTHON", "doxygen", (("##", "#", "#"),)) |
27
|
|
|
|
28
|
|
|
uut = DocumentationComment("qwertzuiop", |
29
|
|
|
docdef, |
30
|
|
|
("##", "#", "#"), |
31
|
|
|
None) |
32
|
|
|
|
33
|
|
|
self.assertEqual(uut.documentation, "qwertzuiop") |
34
|
|
|
self.assertEqual(str(uut), "qwertzuiop") |
35
|
|
|
self.assertIs(uut.docstyle, docdef) |
36
|
|
|
self.assertEqual(uut.marker, ("##", "#", "#")) |
37
|
|
|
self.assertEqual(uut.range, None) |
38
|
|
|
|
39
|
|
|
|
40
|
|
|
if __name__ == '__main__': |
41
|
|
|
unittest.main(verbosity=2) |
42
|
|
|
|