Changeset 37
- Timestamp:
- 06/01/06 16:46:02 (7 years ago)
- Files:
-
- branches/mk/cheesecake/codeparser.py (modified) (1 diff)
- branches/mk/tests/data/module1.py (modified) (2 diffs)
- branches/mk/tests/test_code_parser.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/mk/cheesecake/codeparser.py
r36 r37 61 61 ], 62 62 63 'javadoc': [], 63 # javadoc reference: http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/javadoc.html 64 'javadoc': [ 65 re.compile(r'<[a-zA-z]+[^>]*>'), # HTML elements 66 line_markup(r'@[a-z][a-zA-Z]*\s', r''), # normal tags 67 re.compile(r'{@ ((docRoot) | (inheritDoc) | (link) | (linkplain) |'\ 68 ' (value)) [^}]* }', re.VERBOSE), # special tags 69 ], 64 70 } 65 71 branches/mk/tests/data/module1.py
r36 r37 8 8 """ 9 9 Docstring for Class1 10 11 @see how.Tests#are(performed) 10 12 """ 11 13 … … 89 91 """This is test function for the epytext parser. 90 92 91 @param argument: Description of an argument. 93 @param argument: And you really can't say if this is 94 epytext or javadoc! We count both. 92 95 """ 93 96 pass branches/mk/tests/test_code_parser.py
r36 r37 50 50 assert self.code1.docstring_count_by_type('reST') == 2 51 51 assert self.code1.docstring_count_by_type('epytext') == 3 52 assert self.code1.docstring_count_by_type('javadoc') == 2 52 53 53 54 def test_docstrings(self): … … 70 71 "module1.func8", 71 72 ] 72 73 73 objects_with_rest_docstrings = [ 74 74 "module1.Class1.method5", 75 75 "module1.func7", 76 76 ] 77 78 77 objects_with_epytext_docstrings = [ 79 78 "module1", 80 79 "module1.Class3", 81 80 "module1.func8", 81 ] 82 objects_with_javadoc_docstrings = [ 83 "module1.Class1", 84 "module1.func8", # intentional overlap with epytext 82 85 ] 83 86 … … 87 90 assert set(objects_with_rest_docstrings) == set(self.code1.docstrings_by_format['reST']) 88 91 assert set(objects_with_epytext_docstrings) == set(self.code1.docstrings_by_format['epytext']) 92 assert set(objects_with_javadoc_docstrings) == set(self.code1.docstrings_by_format['javadoc']) 89 93 90 94 … … 144 148 145 149 self._do_it('epytext', valid_test_strings, invalid_test_strings) 150 151 def test_javadoc(self): 152 valid_test_strings = [ 153 'Inline <a href="{@docRoot}/html/documents/">are ugly</a>!', 154 "Call {@link #test_javadoc(object) test_javadoc} method.", 155 '@see Why#java(sucks)', 156 ] 157 invalid_test_strings = [ 158 "Normal text.", 159 "mail.address@example.com", 160 "Mathematical: a < b < c while x > y.", 161 "@it: is not javadoc, but epytext!", 162 ] 163 164 self._do_it('javadoc', valid_test_strings, invalid_test_strings)
