Show
Ignore:
Timestamp:
05/31/06 17:32:14 (6 years ago)
Author:
mk
Message:

Check docstrings for use of reST (closes ticket #11).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/mk/tests/test_code_parser.py

    r32 r33  
    22 
    33import _path_cheesecake 
     4from _helper_cheesecake import set 
     5 
    46from cheesecake.codeparser import CodeParser 
    57 
     
    2224        "module1.Class1.method2",  
    2325        "module1.Class1.method3", 
    24         "module1.Class1.method4"] 
     26        "module1.Class1.method4", 
     27        "module1.Class1.method5",] 
    2528 
    2629    def test_functions(self): 
     
    3134        "module1.func4",  
    3235        "module1.__func5__", 
    33         "module1.func6"] 
     36        "module1.func6", 
     37        "module1.func7"] 
    3438 
    3539    def test_count(self): 
    36         assert self.code1.object_count() == 15 
    37         assert self.code1.docstring_count() == 12 
     40        assert self.code1.object_count() == 17 
     41        assert self.code1.docstring_count() == 14 
     42        assert self.code1.rest_docstring_count() == 2 
    3843 
    3944    def test_docstrings(self): 
     
    4752            "module1.Class1.method2", 
    4853            "module1.Class1.method3", 
     54            "module1.Class1.method5", 
    4955            "module1.func1", 
    5056            "module1.func2", 
    5157            "module1.func3", 
    5258            "module1.__func5__", 
     59            "module1.func7", 
    5360        ] 
    5461 
    55         objects_without_docstrings = [ 
    56             "module1.Class1.method4", 
    57             "module1.func4", 
    58             "module1.func6", 
     62        objects_with_rest_docstrings = [ 
     63            "module1.Class1.method5", 
     64            "module1.func7", 
    5965        ] 
    6066 
    6167        print self.code1.docstrings 
    6268 
    63         for obj in objects_with_docstrings: 
    64             assert self.code1.docstrings.get(obj) == 1 
    65  
    66         for obj in objects_without_docstrings: 
    67             assert not self.code1.docstrings.get(obj) 
     69        assert set(objects_with_docstrings) == set(self.code1.docstrings) 
     70        assert set(objects_with_rest_docstrings) == set(self.code1.rest_docstrings)