diff options
-rw-r--r-- | prolog/problems/family_relations/sister_2/common.py | 4 | ||||
-rw-r--r-- | python/problems/introduction/fahrenheit_to_celsius/common.py | 7 |
2 files changed, 5 insertions, 6 deletions
diff --git a/prolog/problems/family_relations/sister_2/common.py b/prolog/problems/family_relations/sister_2/common.py index 9be9e6d..96ff47d 100644 --- a/prolog/problems/family_relations/sister_2/common.py +++ b/prolog/problems/family_relations/sister_2/common.py @@ -17,7 +17,7 @@ sister(X, Y) :- import prolog.engine import server.problems -def test(program): +def test(session, program): # Test queries and expected answers (values of X). queries = [ ('sister(melanie, X)', set(['andrew'])), @@ -46,7 +46,7 @@ def test(program): return n_correct, len(queries) -def hint(program): +def hint(session, program): if '\=' not in program and '\==' not in program: return [{'id': 'x_y_must_be_different'}] return None diff --git a/python/problems/introduction/fahrenheit_to_celsius/common.py b/python/problems/introduction/fahrenheit_to_celsius/common.py index 53a17f8..1555cf7 100644 --- a/python/problems/introduction/fahrenheit_to_celsius/common.py +++ b/python/problems/introduction/fahrenheit_to_celsius/common.py @@ -11,10 +11,9 @@ f = float(input("Temperatura [F]: ")) print("Temperatura je", c, "C") ''' -from python.engine import run from python.util import has_token_sequence -def test(code): +def test(session, code): # List of inputs: (expression to eval, stdin). test_in = [ (None, '0\n'), @@ -26,7 +25,7 @@ def test(code): ] # List of outputs: (expression result, stdout, stderr, exception). - answers = run(code=code, inputs=test_in, timeout=1.0) + answers = session.get_python().run(code=code, inputs=test_in, timeout=1.0) outputs = [ans[1] for ans in answers] n_correct = 0 @@ -35,7 +34,7 @@ def test(code): n_correct += 1 return n_correct, len(test_in) -def hint(code): +def hint(session, code): if not code: return [{'id': 'plan'}] if not has_token_sequence(code, ['input']): |