Skip to content

Commit

Permalink
DocumentationComment: Remove param type asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
sils committed May 16, 2015
1 parent f3fc9e5 commit 5d5766d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 31 deletions.
12 changes: 5 additions & 7 deletions coalib/settings/DocumentationComment.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ class DocumentationComment:
def __init__(self, desc, param_dict, retval_desc):
"""
Represents a documentation comment of a python class or function.
"""
if not isinstance(desc, str):
raise TypeError("desc should be a string")
if not isinstance(param_dict, dict):
raise TypeError("param_dict should be a dict")
if not isinstance(retval_desc, str):
raise TypeError("retval_desc should be a string")
:param desc: A description as string.
:param param_dict: A dictionary containing parameter names as key and
their description as value.
:param retval_desc: A string describing the return value.
"""
self.desc = desc
self.param_dict = param_dict
self.retval_desc = retval_desc
Expand Down
26 changes: 2 additions & 24 deletions coalib/tests/settings/DocumentationCommentTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,16 @@


class DocumentationCommentParserTest(unittest.TestCase):
def test_construction(self):
self.assertRaises(TypeError,
DocumentationComment,
desc=5,
param_dict={},
retval_desc="")
self.assertRaises(TypeError,
DocumentationComment,
desc="",
param_dict=5,
retval_desc="")
self.assertRaises(TypeError,
DocumentationComment,
desc="",
param_dict={},
retval_desc=5)
self.assertRaises(TypeError,
DocumentationComment.from_docstring,
docstring=5)

def test_from_docstring(self):
self.check_from_docstring_dataset("")
self.check_from_docstring_dataset(" description only ",
desc="description only")
self.check_from_docstring_dataset(" :param test: test description ",
param_dict={
"test": "test description"
})
"test": "test description"})
self.check_from_docstring_dataset(" @param test: test description ",
param_dict={
"test": "test description"
})
"test": "test description"})
self.check_from_docstring_dataset(" :return: something ",
retval_desc="something")
self.check_from_docstring_dataset(" @return: something ",
Expand Down

0 comments on commit 5d5766d

Please sign in to comment.