【发布时间】:2017-08-03 20:20:12
【问题描述】:
此单元测试失败,但出现以下异常:
def test_vote_form_with_multiple_choices_allowed_and_submitted(self):
"""
If multiple choices are allowed and submitted, the form should be valid.
"""
vote_form = VoteForm({'choice': [1, 2]}, instance=create_question('Dummy question', -1,
[Choice(choice_text='First choice'), Choice(
choice_text='Second choice')],
allow_multiple_choices=True))
self.assertTrue(vote_form.is_valid())
self.assertQuerysetEqual(vote_form.cleaned_data['choice'], ['<Choice: First choice>', '<Choice: Second choice>'])
ValueError: 试图将无序查询集与多个有序值进行比较
我做错了什么?
【问题讨论】:
标签: python django unit-testing django-queryset