-
Notifications
You must be signed in to change notification settings - Fork 130
Hk improve tests #360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hk improve tests #360
Changes from all commits
22503c9
e9c1e12
60b9a72
6950230
8a51a49
0a6c162
96698ca
5c1a1bf
b299110
627c7a9
7aac0d9
129dedb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,51 +1,32 @@ | ||
| import sys | ||
| import unicodedata | ||
| import re | ||
| from glob import * | ||
| import glob | ||
| import unittest | ||
|
|
||
| DOC_FILES = glob.glob("doc/html/*.htm*") | ||
|
|
||
| class TestDoxygenOutput(unittest.TestCase): | ||
| """ Test class for the doxygen output. """ | ||
|
|
||
| def test_hash(self): | ||
| ''' Test case is checking if there are illegal hash chars in the documentation. -> doxygen link not found. ''' | ||
| for file in glob("doc/html/*.htm*"): | ||
| with open(file, "rt") as fin: | ||
| i = 0 | ||
|
|
||
| for line in fin: | ||
| i += 1 | ||
| matchHash = re.search(r"([\s>]|^)#\w(\S)*", line) | ||
|
|
||
| if matchHash is not None: | ||
| self.assertIsNone(matchHash, file + " in line " + str(i) + ": not permitted hash found. Search for: '"+ line[matchHash.start():matchHash.end()]) | ||
| for file in DOC_FILES: | ||
| with open(file, "rt") as fin, self.subTest(file=file): | ||
| for i, line in enumerate(fin, start=1): | ||
| self.assertNotRegex(line, r"([\s>]|^)#\w(\S)*", file + " in line " + str(i) + ": not permitted hash found.") | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the assertion message is good enough so that we dont need to manually add the offending section again.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may be right!
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. |
||
|
|
||
|
|
||
| def test_slash_triplet(self): | ||
| ''' Test case is checking if there are slash triplets in the documentation. -> doxygen didn't interpret something properly. ''' | ||
|
|
||
| for file in glob("doc/html/*.htm*"): | ||
| with open(file, "rt") as fin: | ||
| i = 0 | ||
|
|
||
| for line in fin: | ||
| i += 1 | ||
| matchHash = re.search(r"([\s>]|^)///\s*",line) | ||
|
|
||
| if matchHash is not None: | ||
| self.assertIsNone(matchHash, file + " in line " + str(i) + ": not permitted slash triplet found. Search for: '"+line[matchHash.start():matchHash.end()]) | ||
| for file in DOC_FILES: | ||
| with open(file, "rt") as fin, self.subTest(file=file): | ||
| for i, line in enumerate(fin, start=1): | ||
| self.assertNotRegex(line, r"([\s>]|^)///\s*", file + " in line " + str(i) + ": not permitted slash triplet found.") | ||
|
|
||
|
|
||
| def test_backslash_triplet(self): | ||
| ''' Test case is checking if there are backslash triplets in the documentation. -> doxygen didn't interpret something properly. ''' | ||
| for file in glob("doc/html/*.htm*"): | ||
| with open(file, "rt") as fin: | ||
| i = 0 | ||
|
|
||
| for line in fin: | ||
| i += 1 | ||
| matchHash = re.search(r"([\s>]|^)\\\\\\\s*",line) | ||
|
|
||
| if matchHash is not None: | ||
| self.assertIsNone(matchHash, file + " in line " + str(i) + ": not permitted backslash triplet found. Search for: '"+line[matchHash.start():matchHash.end()]) | ||
| for file in DOC_FILES: | ||
| with open(file, "rt") as fin, self.subTest(file=file): | ||
| for i, line in enumerate(fin, start=1): | ||
| self.assertNotRegex(line, r"([\s>]|^)\\\\\\\s*", file + " in line " + str(i) + ": not permitted backslash triplet found.") | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,22 @@ | ||
| import sys | ||
| import unicodedata | ||
| import re | ||
| from glob import * | ||
| import glob | ||
| import unittest | ||
|
|
||
| PROTO_FILES = glob.glob("*.proto") | ||
|
|
||
| class TestInvalidCommentType(unittest.TestCase): | ||
| """Test class for invalid comment types""" | ||
|
|
||
| def test_triple_slash(self): | ||
| ''' Test to check if more than two forward slash('/') are present in comment section of proto file. ''' | ||
| for file in glob("*.proto"): | ||
| with open(file, "rt") as fin: | ||
| i = 0 | ||
|
|
||
| for line in fin: | ||
| i += 1 | ||
| for file in PROTO_FILES: | ||
| with open(file, "rt") as fin, self.subTest(file=file): | ||
| for i, line in enumerate(fin, start=1): | ||
| self.assertEqual(line.find("///"), -1, file + " in line " + str(i) + ": not permitted use of '///' ") | ||
|
|
||
| def test_comments_invalid_syntax(self): | ||
| ''' Test to check if comments are given using invalid syntax '/*' or '*/' ''' | ||
| for file in glob("*.proto"): | ||
| with open(file, "rt") as fin: | ||
| i = 0 | ||
|
|
||
| for line in fin: | ||
| i += 1 | ||
| for file in PROTO_FILES: | ||
| with open(file, "rt") as fin, self.subTest(file=file): | ||
| for i, line in enumerate(fin, start=1): | ||
| self.assertEqual(line.find("/*"), -1, file + " in line " + str(i) + ": not permitted use of '/*' ") | ||
| self.assertEqual(line.find("*/"), -1, file + " in line " + str(i) + ": not permitted use of '*/' ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this was indented incorrectly which caused PRs to deploy the docs :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have a new maintainer 💃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True thanks for finding :)