Loading doc/analysis/parserobotfile.py +43 −2 Original line number Diff line number Diff line Loading @@ -692,8 +692,33 @@ class ParseRobotFile: value = re.sub(r'\n\s*\.{3}\s*', ' ', doc_content[match.end():end]) sections[key] = value.replace('\n', ' ').strip().rstrip('.') if 'pre_conditions' in sections: sections['pre_conditions'] = self._format_iop_preconditions(sections['pre_conditions']) return sections @staticmethod def _format_iop_preconditions(preconditions: str): match = re.match( r'^(.*?)(Data (?:only on leaves|on every broker))\.\s+((?:b\d+\s+contains\s+).+)$', preconditions, ) if match is None: return preconditions prefix, data_location, broker_data = match.groups() broker_entries = re.split(r'\.\s+(?=b\d+\s+contains\s+)', broker_data) prefix_entries = [ entry.strip() for entry in prefix.rstrip('. ').split('.') if entry.strip() ] return [ *prefix_entries, f"{data_location}:", [entry.rstrip('.') for entry in broker_entries], ] def get_iop_test_tags(self, test_name: str) -> list: """Extract [Tags] from a specific IOP test case.""" if test_name not in self.test_cases: Loading @@ -715,8 +740,24 @@ class ParseRobotFile: return [] test_content = self.test_cases[test_name] comments = re.findall(r'^\s*#(.+?)$', test_content, re.MULTILINE) return [comment.strip() for comment in comments] raw_comments = re.findall(r'^\s*#(.+?)$', test_content, re.MULTILINE) comments = [] nested_comments = None for raw_comment in raw_comments: comment = raw_comment.strip() if comment.startswith('-'): if not comments: raise ValueError(f"IOP test '{test_name}' has a list item without a parent step") if nested_comments is None: nested_comments = [] comments.append(nested_comments) nested_comments.append(comment[1:].strip()) else: comments.append(comment) nested_comments = None return comments def get_iop_setup(self, test_name: str) -> str: """Extract [Setup] from a specific IOP test case.""" Loading Loading
doc/analysis/parserobotfile.py +43 −2 Original line number Diff line number Diff line Loading @@ -692,8 +692,33 @@ class ParseRobotFile: value = re.sub(r'\n\s*\.{3}\s*', ' ', doc_content[match.end():end]) sections[key] = value.replace('\n', ' ').strip().rstrip('.') if 'pre_conditions' in sections: sections['pre_conditions'] = self._format_iop_preconditions(sections['pre_conditions']) return sections @staticmethod def _format_iop_preconditions(preconditions: str): match = re.match( r'^(.*?)(Data (?:only on leaves|on every broker))\.\s+((?:b\d+\s+contains\s+).+)$', preconditions, ) if match is None: return preconditions prefix, data_location, broker_data = match.groups() broker_entries = re.split(r'\.\s+(?=b\d+\s+contains\s+)', broker_data) prefix_entries = [ entry.strip() for entry in prefix.rstrip('. ').split('.') if entry.strip() ] return [ *prefix_entries, f"{data_location}:", [entry.rstrip('.') for entry in broker_entries], ] def get_iop_test_tags(self, test_name: str) -> list: """Extract [Tags] from a specific IOP test case.""" if test_name not in self.test_cases: Loading @@ -715,8 +740,24 @@ class ParseRobotFile: return [] test_content = self.test_cases[test_name] comments = re.findall(r'^\s*#(.+?)$', test_content, re.MULTILINE) return [comment.strip() for comment in comments] raw_comments = re.findall(r'^\s*#(.+?)$', test_content, re.MULTILINE) comments = [] nested_comments = None for raw_comment in raw_comments: comment = raw_comment.strip() if comment.startswith('-'): if not comments: raise ValueError(f"IOP test '{test_name}' has a list item without a parent step") if nested_comments is None: nested_comments = [] comments.append(nested_comments) nested_comments.append(comment[1:].strip()) else: comments.append(comment) nested_comments = None return comments def get_iop_setup(self, test_name: str) -> str: """Extract [Setup] from a specific IOP test case.""" Loading