You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that one cannot use a variable named ton a test.
If you have something like
t=1# SOLUTION
and then a test like
t==1
you get an error. (Maybe a problem with conflicting variable names?) See the very simple attached file as an example. bug.zip (The ZIP file contains only a very simple notebook.)
Here is the output of trying to create an assignment:
$ otter assign bug.ipynb bug_dist
Traceback (most recent call last):
File "/home/finotti/.venvs/DS/bin/otter", line 8, in <module>
sys.exit(cli())
^^^^^
File "/home/finotti/.venvs/DS/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/finotti/.venvs/DS/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/finotti/.venvs/DS/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/finotti/.venvs/DS/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/finotti/.venvs/DS/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/finotti/.venvs/DS/lib/python3.11/site-packages/otter/cli.py", line 32, in wrapper
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/home/finotti/.venvs/DS/lib/python3.11/site-packages/otter/cli.py", line 64, in assign_cli
return assign(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/finotti/.venvs/DS/lib/python3.11/site-packages/otter/assign/__init__.py", line 157, in main
run_tests(assignment, debug=debug)
File "/home/finotti/.venvs/DS/lib/python3.11/site-packages/otter/assign/utils.py", line 230, in run_tests
raise RuntimeError(f"Some autograder tests failed in the autograder notebook:\n" + \
RuntimeError: Some autograder tests failed in the autograder notebook:
q1 results:
q1 - 1 result:
❌ Test case failed
Trying:
t == 1
Expecting:
True
**********************************************************************
Line 1, in q1 0
Failed example:
t == 1
Expected:
True
Got:
False
Simple renaming the variable to something else, like tt makes it work.
I'm using Python 3.11.9 (from Debian Sid) and otter 5.5.0.
Interesting, it looks like a confluence of things is causing this bug. Because the only test case for the question is hidden, Otter by default doesn't include a check cell for the question after the solution cell, so all tests will get run at the end of the notebook. However, in order to run the tests, Otter's generated code reassigns the variable t:
so t is no longer 1 when the test is run. It should be relatively simple to change the loop variable to something that won't cause collisions (i.e. a variable with a random name).
It seems that one cannot use a variable named
t
on a test.If you have something like
and then a test like
you get an error. (Maybe a problem with conflicting variable names?) See the very simple attached file as an example.
bug.zip (The ZIP file contains only a very simple notebook.)
Here is the output of trying to create an assignment:
Simple renaming the variable to something else, like
tt
makes it work.I'm using Python 3.11.9 (from Debian Sid) and otter 5.5.0.
If relevant:
I can get around the issue (by renaming the variable), but I thought I should make the developers aware.
The text was updated successfully, but these errors were encountered: