Skip to content

Commit

Permalink
Tweak indentation of PyString in behat test.
Browse files Browse the repository at this point in the history
  • Loading branch information
trampgeek committed Nov 12, 2024
1 parent df5aded commit f411b8d
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions tests/behat/test_combinator_grader.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@ Feature: test_combinator_grader
And I set the field "id_useace" to "0"
And I set the field "id_uiplugin" to "None"
And I set the field "id_template" to:
"""
import subprocess, json, sys
{{ STUDENT_ANSWER | e('py') }}
tests = json.loads('''{{ TESTCASES | json_encode | e('py') }}''')
test_results = [['Test', 'Expected', 'Got', 'iscorrect']]
num_right = 0
for test in tests:
code = test['testcode']
expected = int(test['expected'])
got = eval(code)
test_results.append([code, expected, got, expected == got])
if expected == got:
num_right += 1
print(json.dumps({
'testresults': test_results,
'fraction': num_right / len(tests),
'prologuehtml': '<h1>I am a prologue</h1>',
'epiloguehtml': '<h1>I am an epilogue</h1>'
}))
"""
"""
import subprocess, json, sys
{{ STUDENT_ANSWER | e('py') }}
tests = json.loads('''{{ TESTCASES | json_encode | e('py') }}''')
test_results = [['Test', 'Expected', 'Got', 'iscorrect']]
num_right = 0
for test in tests:
code = test['testcode']
expected = int(test['expected'])
got = eval(code)
test_results.append([code, expected, got, expected == got])
if expected == got:
num_right += 1
print(json.dumps({
'testresults': test_results,
'fraction': num_right / len(tests),
'prologuehtml': '<h1>I am a prologue</h1>',
'epiloguehtml': '<h1>I am an epilogue</h1>'
}))
"""
And I set the field "id_iscombinatortemplate" to "1"
And I set the field "id_grader" to "TemplateGrader"
And I click on "a[aria-controls='id_advancedcustomisationheadercontainer']" "css_element"
Expand All @@ -69,6 +69,7 @@ Feature: test_combinator_grader
| id_ordering_1 | 20 |
| id_answer | def sqr(n): return n * n |

And I wait "180" seconds
Then I should see "Failed testing"
And I should see "Click on the << button to replace the expected output of this testcase with actual output."

Expand Down

0 comments on commit f411b8d

Please sign in to comment.