Skip to content

Commit

Permalink
[run_test.py] Use str.format instead of "%s" % for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
ypid-geberit committed Sep 17, 2020
1 parent f6bbc92 commit efad59e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Alerting/Sample Watches/run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,18 @@ def load_file(serialized_file):

# Confirm Matches
match = test['match'] if 'match' in test else True
print("Expected: Watch Condition: %s" % match)
print("Expected: Watch Condition: {}".format(match))
if 'condition' not in response['watch_record']['result']:
print("Condition not evaluated due to watch error: {}".format(
json.dumps(response['watch_record'], sort_keys=True, indent=2)
))
print("TEST FAIL")
sys.exit(1)
met = response['watch_record']['result']['condition']['met']
print("Received: Watch Condition: %s" % met)
print("Received: Watch Condition: {}".format(met))
if match:
if met and response['watch_record']['result']['condition']['status'] == "success":
print("Expected: %s" % test.get('expected_response'))
print("Expected: {}".format(test.get('expected_response')))
if len(response['watch_record']['result']['actions']) == 0:
if response['watch_record']['result']['transform']['status'] == 'failure':
print("No actions where taken because transform failed: {}".format(
Expand Down Expand Up @@ -183,7 +183,7 @@ def load_file(serialized_file):
sys.exit(1)
logging = logging_action['logging']
if logging:
print("Received: %s" % logging['logged_text'])
print("Received: {}".format(logging['logged_text']))
if logging['logged_text'] == test.get('expected_response'):
print("TEST PASS")
sys.exit(0)
Expand All @@ -192,5 +192,5 @@ def load_file(serialized_file):
print("TEST FAIL")
sys.exit(1)
else:
print("TEST %s" % ("FAIL" if response['watch_record']['result']['condition']['met'] else "PASS"))
print("TEST {}".format("FAIL" if response['watch_record']['result']['condition']['met'] else "PASS"))
sys.exit(met)

0 comments on commit efad59e

Please sign in to comment.