-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_parser.py
32 lines (25 loc) · 888 Bytes
/
test_parser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import sys
cursor_line_number = 130
last_method_name = None
lastBlock = ''
saw_is_test = False
about_to_see_method_name = False
parent_method_name = ''
with open("output.txt", "r") as f:
for line in f:
components = line.split()
current_line_number = components[0].split(',')[0]
currentBlock = components[2]
if lastBlock == "'@'" and currentBlock == "'isTest'":
saw_is_test = True
lastBlock = currentBlock
if saw_is_test and currentBlock == "'void'":
about_to_see_method_name = True
saw_is_test = False
elif not saw_is_test and about_to_see_method_name:
about_to_see_method_name = False
last_method_name = currentBlock
if int(current_line_number) < cursor_line_number:
parent_method_name = last_method_name
f.close()
print parent_method_name