canvasapi icon indicating copy to clipboard operation
canvasapi copied to clipboard

setting other attributes of `QuizQuestion` resets `QuizQuestion.question_text`

Open dave-doty opened this issue 1 year ago • 0 comments

Describe the bug

Setting QuizQuestion.question_type (or it appears, other attributes such as QuizQuestion.answers) resets QuizQuestion.question_text after the latter has been set.

To Reproduce

Steps to reproduce the behavior:

Get a QuizQuestion object from a course and set its question_text, then its question_type attributes using QuizQuestion.edit:

course = canvasutil.get_course(123456)
quiz = course.get_quiz(654321)
question = quiz.get_questions()[0]
question.edit({'question_text': 'new question text'})
print(question.question_text)
question.edit({'question_type': 'multiple_dropdowns_question'})
print(question.question_text)

Expected behavior

Expected output:

new question text
new question text

Actual output:

new question text
Question text

I believe "Question text" is the default value for that field.

Environment information

  • Python version (python --version) 3.8.12
  • CanvasAPI version (pip show canvasapi) 3.0.0

Additional context

Add any other context about the problem here.

dave-doty avatar Dec 28 '22 23:12 dave-doty