Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect highlighting because of flaws in ObjectAssignmentParser #359

Open
filipsch opened this issue Sep 26, 2018 · 0 comments
Open

Incorrect highlighting because of flaws in ObjectAssignmentParser #359

filipsch opened this issue Sep 26, 2018 · 0 comments
Labels

Comments

@filipsch
Copy link
Contributor

filipsch commented Sep 26, 2018

When checking whether an object is correctly created and the exercise only contains a single = operator in addition to other 'object-mutating' operations that don't use =, highlighting trips up.

Reproducible example (in words)

# solution
x = []
for i in range(3):
    x.append(i)

# sct
Ex().check_object('x').has_equal_value()

If the student submits:

# student
x = []
for i in range(3):
    x.append(2 * i)

The x = [] will be highlighted, even though the mistake is in the x.append() step. This is extremely confusing for students! You can see it in action here

Reproducible example (in code)

from pythonwhat.local import setup_state
from pythonwhat.Test import TestFail
sol_code = "x = []\nfor i in range(3): x.append(i)"
stu_code = "x = []\nfor i in range(3): x.append(2 * i)"
s = setup_state(sol_code, stu_code)
try:
    s.check_object('x').has_equal_value()
except TestFail as e:
    line_info = e.feedback.line_info

line_info

This will print out:

{'column_start': 0, 'line_start': 1, 'line_end': 1, 'column_end': 6}

While it should have a line_start on line_end equal to 2, or just not highlight anything at all.

@filipsch filipsch added the bug label Sep 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant