summaryrefslogtreecommitdiff
path: root/python/problems/introduction
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.org>2015-09-11 11:23:24 +0200
committerTimotej Lazar <timotej.lazar@araneo.org>2015-09-11 11:23:24 +0200
commitf42daa8b31b5772f60d8d8656ad2a5d5d6fd6f67 (patch)
tree1b2d75e99eb6189dc72de2b60836b41afc5fd354 /python/problems/introduction
parent046463bcebe08c6cbe3504d676c0bf27f8695482 (diff)
Replace session parameter with Python run function
In hint and test functions, we don't need any session data except the Python runner.
Diffstat (limited to 'python/problems/introduction')
-rw-r--r--python/problems/introduction/fahrenheit_to_celsius/common.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/python/problems/introduction/fahrenheit_to_celsius/common.py b/python/problems/introduction/fahrenheit_to_celsius/common.py
index 5c8e0cd..34f2832 100644
--- a/python/problems/introduction/fahrenheit_to_celsius/common.py
+++ b/python/problems/introduction/fahrenheit_to_celsius/common.py
@@ -19,7 +19,7 @@ hint_type = {
'no_input_call': Hint('no_input_call'),
}
-def test(session, code):
+def test(python, code):
# List of inputs: (expression to eval, stdin).
test_in = [
(None, '0\n'),
@@ -31,7 +31,7 @@ def test(session, code):
]
# List of outputs: (expression result, stdout, stderr, exception).
- answers = session.get_python().run(code=code, inputs=test_in, timeout=1.0)
+ answers = python(code=code, inputs=test_in, timeout=1.0)
outputs = [ans[1] for ans in answers]
n_correct = 0
@@ -40,7 +40,7 @@ def test(session, code):
n_correct += 1
return n_correct, len(test_in)
-def hint(session, code):
+def hint(python, code):
if not code:
return [{'id': 'plan'}]
if not has_token_sequence(code, ['input']):