-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_output.py
More file actions
70 lines (61 loc) · 2.1 KB
/
test_output.py
File metadata and controls
70 lines (61 loc) · 2.1 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from src import ampfunctions
try:
results = []
total = 0
statusCode = 200
i = 0
while i < 5:
if i % 2 == 0:
getattr(ampfunctions,'Write')("Processing even number: " + str(i))
else:
getattr(ampfunctions,'Write')("Processing odd number: " + str(i))
total += i
i += 1
getattr(ampfunctions,'Write')("Total from JS: " + str(total))
from src import ampfunctions
itemCount_amp = None
itemName_amp = None
processedItems_amp = None
counter_amp = None
tempResult_amp = None
itemCount_amp = 10
itemName_amp = 'Widget'
counter_amp = 0
processedItems_amp = ''
i_amp = 1
while i_amp < 3:
if i_amp == 1:
getattr(ampfunctions,'V')('Processing first batch')
elif i_amp == 2:
getattr(ampfunctions,'V')('Processing second batch')
else:
getattr(ampfunctions,'V')('Processing final batch')
counter_amp = counter_amp + 1
i_amp += 1
threshold = 50
threshold = 50
if total > threshold:
getattr(ampfunctions,'Write')("Total exceeds threshold")
statusCode = 201
else:
getattr(ampfunctions,'Write')("Total within acceptable range")
statusCode = 200
from src import ampfunctions
dataItems_amp = None
status_amp = None
message_amp = None
status_amp = 'active'
message_amp = 'Processing complete'
if counter_amp > 0:
getattr(ampfunctions,'V')('Counter is positive')
if counter_amp == 3:
getattr(ampfunctions,'V')('Exactly three items processed')
finalResult = dict(code=statusCode, processed=total, items=results["length"])
getattr(ampfunctions,'Write')("Final status code: " + str(finalResul)t["code"])
getattr(ampfunctions,'Write')("Processed items count: " + str(finalResul)t["processed"])
except Exception as error:
getattr(ampfunctions,'Write')("Error occurred: " + str(error))
from src import ampfunctions
errorLogged_amp = None
errorLogged_amp = 1
getattr(ampfunctions,'V')('Error was logged in AmpScript')