def visitFunction(self, node, parent=None): if parent and node.name == 'body' and len( node.argnames) > 0 and node.argnames[0] == 'self': # This is the body function of a Test Case. # We should reference its docstring and arguments for Test Case parameters documentation. parent.argumentsDocstring = Documentation.trim(node.doc) parent.arguments = node.argnames[1:]
def visitClass(self, node, parent = None): role = None if len(node.bases) > 0 and "TestCase" in [hasattr(x, 'name') and x.name or None for x in node.bases]: role = "testcase" elif len(node.bases) > 0 and "Preamble" in [hasattr(x, 'name') and x.name or None for x in node.bases]: role = "preamble" elif len(node.bases) > 0 and "Postamble" in [hasattr(x, 'name') and x.name or None for x in node.bases]: role = "postamble" if role: # This is a TestCase/Preamble/Postamble instance. currentTestCase = TestCaseVariables(node.name, docstring = Documentation.trim(node.doc).decode('utf-8'), role = role) self._results.append(currentTestCase) # Search for its body() function. self.walkChildren(node.code, currentTestCase)
def visitClass(self, node, parent=None): role = None if len(node.bases) > 0 and "TestCase" in [ hasattr(x, 'name') and x.name or None for x in node.bases ]: role = "testcase" elif len(node.bases) > 0 and "Preamble" in [ hasattr(x, 'name') and x.name or None for x in node.bases ]: role = "preamble" elif len(node.bases) > 0 and "Postamble" in [ hasattr(x, 'name') and x.name or None for x in node.bases ]: role = "postamble" if role: # This is a TestCase/Preamble/Postamble instance. currentTestCase = TestCaseVariables(node.name, docstring=Documentation.trim( node.doc).decode('utf-8'), role=role) self._results.append(currentTestCase) # Search for its body() function. self.walkChildren(node.code, currentTestCase)
def visitFunction(self, node, parent = None): if parent and node.name == 'body' and len(node.argnames) > 0 and node.argnames[0] == 'self': # This is the body function of a Test Case. # We should reference its docstring and arguments for Test Case parameters documentation. parent.argumentsDocstring = Documentation.trim(node.doc) parent.arguments = node.argnames[1:]