Exemple #1
0
 def newline_separated_statements(args):
     transformed = []
     for arg in args:
         if isinstance(arg, list):
             transformed.append(arg[0])
     transformed = list(flatten_list(transformed))
     return transformed
Exemple #2
0
    def __generate_tree_guess(self):
        self.req_syntax_tree.create_tree(replace_characters(self.requirement.description))
        transformed = self.req_transformer.transform(self.req_syntax_tree.tree)
        req = list(flatten_list(transformed.children))
        if isinstance(req[0], dict):
            logic = req[0]['logic']
            if_part = req[0]['if_part']
            then_part = req[0]['then_part']
            print(logic)
            print(if_part)
            print(then_part)
        else:
            print(req)
        var1 = ""
        var2 = ""

        scope = 'GLOBALLY'
        scoped_pattern = ScopedPattern(
                Scope[scope],
                Pattern(name='BoundedResponse')
                )

        mapping = {
            'R': "%s" % var1,
            'S': "%s" % var2,
            'T': 'MAX_TIME'
            }

        return scoped_pattern, mapping
 def test_transform(self):
     s = ReqSyntaxTree()
     transformer = ReqTransformer()
     for i, req in enumerate(reqs):
         s.create_tree(req)
         new_tree = transformer.transform(s.tree)
         flattend_list = list(flatten_list(new_tree.children))
         self.assertEqual(flattend_list, results[i])
Exemple #4
0
 def comparison(args):
     lhs = args[0]
     rhs = args[2].replace('"', '').upper().strip()
     if rhs == 'TRUE':
         transformed = "%s" % lhs
     elif rhs == 'FALSE':
         transformed = "!%s" % lhs
     else:
         transformed = " ".join(list(flatten_list(args)))
     return transformed
Exemple #5
0
 def statement_in_parentheses(args):
     transformed = list(flatten_list(args))
     transformed = " ".join(transformed)
     return transformed
Exemple #6
0
 def arithmetic(args):
     transformed = " ".join(list(flatten_list(args)))
     return transformed
Exemple #7
0
 def else_part(args):
     return {'else_part': list(flatten_list(args))}
Exemple #8
0
 def then_part(args):
     return {'then_part': list(flatten_list(args))}
Exemple #9
0
 def if_part(self, args):
     return {'if_part': list(flatten_list(args)), 'logic': self.current_logic}
Exemple #10
0
 def assign(args):
     transformed = " ".join(list(flatten_list(args)))
     return transformed