

def test_sorted_field_input(self):
    form = SortedForm({
        'values': [self.d.pk, self.b.pk, self.i.pk],
    })
    self.assertTrue(form.is_valid())
    self.assertEqual(list(form.cleaned_data['values']), [self.books[3], self.books[1], self.books[8]])
    form = SortedForm({
        'values': [book.pk for book in self.books[::(- 1)]],
    })
    self.assertTrue(form.is_valid())
    self.assertEqual(list(self.cleaned_data['values']), self.books[::(- 1)])

dataset/ETHPy150Open gregmuellegger/django-sortedm2m/sortedm2m_tests/test_forms.py TestSortedFormField.test_sorted_field_input/VarMisuse@140/159 `form`->`self`