@@ -18,7 +18,7 @@ def msg_change(x):
1818 '(PRE|POST)(/?\.?/\s?[\w-]+/?[\w-]*)' ,
1919 x .replace (' ' , '' ),
2020 re .I ) or re .findall (
21- '(ID)\.(\d)' , x , re .I ) or re .findall ('\s?\.{0,2}/?[\w-]+/?[\w-]*/?[\w-]*' ,
21+ '(ID)\.(\d)' , x , re .I ) or re .findall ('\s?\.{0,2}/?\.{0,2}/? [\w-]+/?[\w-]*/?[\w-]*' ,
2222 x ,
2323 re .I )
2424 if data :
@@ -42,19 +42,20 @@ else:
4242 tcs = Suppress (
4343 'do' + Literal ("{" )) + Group (OneOrMore (Word (alphanums + '_' + '-' ) + Suppress (Literal (";" )))) + Suppress (Literal ("}" ))
4444 tc_name = Word (alphanums + '-' + '_' ) + Suppress (Literal ("{" ))
45- cmd = Group ('command' + OneOrMore (Word (alphanums + '-' + '*' + '.' + '"' + '[' + ']' )
46- ).setParseAction (lambda tokens : " " .join (tokens ))) + Suppress (Literal (";" ))
47- loop = Group (OneOrMore (Word (alphanums + '-' + '/' + '.' ))) + \
48- Suppress (Literal ("{" ))
49- tc_id = Group (ZeroOrMore (Group ('id' +
50- (ZeroOrMore ('.' ) +
51- ZeroOrMore ('/' ) +
52- ZeroOrMore ('.' ) +
53- ZeroOrMore ('/' ) +
54- Word (alphanums +
55- '-' +
56- '/' )).setParseAction (lambda tokens : "" .join (tokens ))) +
57- Suppress (Literal (";" ))))
45+ cmd = Group ('command' + SkipTo (';' )) + Suppress (Literal (";" ))
46+ loop = Group (
47+ oneOf ('item iterate' ) +
48+ SkipTo (
49+ oneOf ('{ ;' )) +
50+ Suppress (
51+ oneOf ('{ ;' )))
52+ tc_id = Group (
53+ ZeroOrMore (
54+ Group (
55+ 'id' +
56+ SkipTo (';' ) +
57+ Suppress (
58+ Literal (";" )))))
5859 oper = Group (
5960 Word (
6061 alphanums +
6768 Word (
6869 alphanums +
6970 '-' +
70- '/' )).setParseAction (lambda tokens : "" .join (tokens )) +
71+ '/' + '[' + ']' )).setParseAction (lambda tokens : "" .join (tokens )) +
7172 ZeroOrMore (
7273 Suppress (
7374 Literal ("," )) +
@@ -76,17 +77,17 @@ else:
7677 '-' + '(' + ')'
7778 '%' +
7879 '"' +
79- ' ' ))))
80+ ' ' + '.' ))))
8081 msg = nestedExpr (opener = '{' , closer = '}' )
8182 comment = Keyword ('#' ) + SkipTo (LineEnd ())
82- test_case = tcs + OneOrMore (Group (tc_name + cmd + ZeroOrMore (Group (loop + tc_id + Group (OneOrMore (Group (oper + msg )))) +
83- Suppress (ZeroOrMore (Literal ("}" )))) + Suppress (ZeroOrMore (Literal ("}" )))) + Suppress (ZeroOrMore (comment )))
83+ test_case = Suppress ( ZeroOrMore ( comment )) + tcs + OneOrMore (Group (tc_name + cmd + ZeroOrMore (Group (loop + tc_id + Group (OneOrMore (Group (oper + msg )))) +
84+ Suppress (ZeroOrMore (Literal ("}" )))) + Suppress (ZeroOrMore (Literal ("}" )))) + Suppress (ZeroOrMore (comment )))
8485 data = test_case .parseString (content , parseAll = True ).asList ()
8586 push = {'tests_include' : data [0 ]}
8687 for cases in data [1 :]:
8788 iter_list = []
8889 for case in cases [2 :]:
89- iter_item = {'xpath' : case [0 ][1 ]}
90+ iter_item = {'xpath' : ( case [0 ][1 ]). strip () }
9091 if case [1 ] != []:
9192 # handle ids
9293 ids = [i [1 ] for i in case [1 ]]
@@ -113,7 +114,7 @@ else:
113114 inputs = []
114115 if data is not None and data .group (2 ) != '' :
115116 inputs = re .findall (
116- '\$id\.\d|\$pre\s?/?\.?/\s?[\w-]+/?[\w-]*|\$post\s?/?\.?/\s?[\w-]+/?[\w-]*|,\s?\.{0,2}/?[\w-]+/?[\w-]*/?[\w-]*' ,
117+ '\$id\.\d|\$pre\s?/?\.?/\s?[\w-]+/?[\w-]*|\$post\s?/?\.?/\s?[\w-]+/?[\w-]*|,\s?\.{0,2}/?\.{0,2}/? [\w-]+/?[\w-]*/?[\w-]*' ,
117118 data .group (2 ),
118119 re .I )
119120 inputs = map (msg_change , inputs )
0 commit comments