From 20d9c7e226ec7e7931a209cde597fbe56b3b8e64 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Thu, 3 Sep 2015 18:25:25 +0200 Subject: Pass the session object to test and hint functions --- python/problems/introduction/fahrenheit_to_celsius/common.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'python/problems/introduction/fahrenheit_to_celsius') 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']): -- cgit v1.2.1