root/trunk/tests/unit/test_index_docstrings.py

Revision 93, 1.1 kB (checked in by mk, 7 years ago)

Use raw index class name as index name.

Line 
1 import os
2 from math import ceil
3
4 import _path_cheesecake
5 from _helper_cheesecake import DATA_PATH
6 from cheesecake.cheesecake_index import Cheesecake, CodeParser
7
8
9 class TestIndexDocstrings(object):
10     def setUp(self):
11         self.cheesecake = Cheesecake(path=os.path.join(DATA_PATH, "package2.tar.gz"))
12
13         modules = 5
14         classes = 2
15         functions = 4
16         methods = 3
17
18         self.documentable_objects = modules + classes + functions + methods
19         self.docstring_count = 7
20
21         self.index_float = float(self.docstring_count) / self.documentable_objects
22         self.index_int = int(ceil(self.index_float*100))
23
24     def tearDown(self):
25         self.cheesecake.cleanup()
26
27     def test_index_docstrings(self):
28         index = self.cheesecake.index["DOCUMENTATION"]["IndexDocstrings"]
29         index.compute_with(self.cheesecake)
30
31         assert index.name == "IndexDocstrings"
32         assert index.value == self.index_int
33         assert index.details == "found %d/%d=%.2f%% objects with docstrings" %\
34                             (self.docstring_count, self.documentable_objects, self.index_float*100)
Note: See TracBrowser for help on using the browser.