Question Authors' Forum

Announcing CodeRunner V4.0.0

Re: Announcing CodeRunner V4.0.0 --- numchecks

by Richard Lobb -
Number of replies: 0

I'm not sure how the "can't deserialise" error came about. You shouldn't generally be able to get that except when viewing a cached result from an earlier version of CodeRunner. So that's a "dunno".

The other two results imply that you don't have version 4.0 installed. If you evaluate a non-existing Twig expression like {{ BLAH }} you just get an empty string. [This was a bad design decision I made about 10 years ago, sorry, but I fear I'd break a lot of questions by fixing it now.]

You can't currently get the CodeRunner version installed through the question authoring interface, though I did just add that capability as a result of your posting :-) However, you can see the entire QUESTION object in user-friendly format by inserting the following code into your template somewhere suitable:

import pprint, json
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(json.loads("""{{ QUESTION | json_encode | e('py') }}"""))

If you have a version of CodeRunner that includes stepinfo you'll see something like the following:

{   'acelang': None,
    'allornothing': '1',
    'allowmultiplestdins': '0',
    'answer': 'print("Hello world!")',
... (snipping stuff out here) ...
    'resultcolumns': None,
    'sandbox': None,
    'sandboxparams': None,
    'stepinfo': {   'fraction': 0,
                    'numchecks': 1,
                    'numprechecks': 0,
                    'preferredbehaviour': 'adaptive'},
    'testcases': [   {   'display': 'SHOW',
                         'expected': 'Hello world!',
                         'extra': '',
                         'hiderestiffail': '0',
                         'id': '1',
                         'mark': '1.000',
                         'questionid': '23',
                         'stdin': '',
                         'testcode': '',
                         'testtype': '0',
                         'useasexample': '0'}],
    'uiparameters': [],
    'uiplugin': 'ace',
    'useace': '1'}

If you don't see a stepinfo field, you're running an older CodeRunner.

BTW: when conducting tests like this, be aware that CodeRunner caches run outcomes, so if you change the question in any way, you also need to change the question (e.g. add a trailing space somewhere) before clicking Check again if you want to see the effect of your change.