summaryrefslogtreecommitdiff
path: root/monkey
diff options
context:
space:
mode:
Diffstat (limited to 'monkey')
-rwxr-xr-xmonkey/monkey.py11
-rw-r--r--monkey/prolog/engine.py2
2 files changed, 5 insertions, 8 deletions
diff --git a/monkey/monkey.py b/monkey/monkey.py
index 8faad1a..5d26c6e 100755
--- a/monkey/monkey.py
+++ b/monkey/monkey.py
@@ -63,15 +63,12 @@ def fix(name, code, edits, aux_code='', timeout=30, debug=False):
for line, (before, after) in path:
print('line ' + str(line) + ':\t' + stringify(before) + ' → ' + stringify(after))
- # if the code is correct, we are done
- try:
- if test(name, code + '\n' + aux_code):
- return code, path, total_time, n_tested
- except:
- pass
+ # If the code is correct, we are done.
+ if test(name, code + '\n' + aux_code):
+ return code, path, total_time, n_tested
n_tested += 1
- # otherwise generate new solutions
+ # Otherwise generate new solutions.
rule_no = 0
for start, end in rules:
rule = lines[start:end]
diff --git a/monkey/prolog/engine.py b/monkey/prolog/engine.py
index 5a640c0..af79535 100644
--- a/monkey/prolog/engine.py
+++ b/monkey/prolog/engine.py
@@ -124,7 +124,7 @@ def test(name, code):
reply = create_and_ask(code=code, query='run_tests({})'.format(name))
return reply['event'] == 'success'
except Exception as ex:
- pass
+ return False
# Basic sanity check.
if __name__ == '__main__':