def test_update(self):
        order = Order(name='Dummy Order')
        order.save()

        item_ids = []
        for i in range(2):
            item = Item(name=i % 'Item %i', sku=str(i) * 13, price=D('9.99'), order=order, status=0)
            item.save()
            item_ids.append(item.id)

        tag = Tag(name='Test', content_object=order)
        tag.save()

        res = self.client.get('/inlines/{}/'.format(order.id))

        self.assertEqual(res.status_code, 200)
        order = Order.objects.get(id=order.id)

        self.assertEqual(2, order.items.count())
        self.assertEqual('Item 0', order.items.all()[0].name)

        data = {
            'name': 'Dummy Order',
            'items-TOTAL_FORMS': '4',
            'items-INITIAL_FORMS': '2',
            'items-MAX_NUM_FORMS': '',
            'items-0-name': 'Bubble Bath',
            'items-0-sku': '1234567890123',
            'items-0-price': D('9.99'),
            'items-0-status': 0,
            'items-0-id': item_ids[0],
            'items-1-name': 'Bubble Bath',
            'items-1-sku': '1234567890123',
            'items-1-price': D('9.99'),
            'items-1-status': 0,
            'items-1-id': item_ids[1],
            'items-2-name': 'Bubble Bath',
            'items-2-sku': '1234567890123',
            'items-2-price': D('9.99'),
            'items-2-status': 0,
            'items-3-DELETE': True,
            'extra_views_tests-tag-content_type-object_id-TOTAL_FORMS': 3,
            'extra_views_tests-tag-content_type-object_id-INITIAL_FORMS': 1,
            'extra_views_tests-tag-content_type-object_id-MAX_NUM_FORMS': '',
            'extra_views_tests-tag-content_type-object_id-0-name': 'Test',
            'extra_views_tests-tag-content_type-object_id-0-id': tag.id,
            'extra_views_tests-tag-content_type-object_id-0-DELETE': True,
            'extra_views_tests-tag-content_type-object_id-1-name': 'Test 2',
            'extra_views_tests-tag-content_type-object_id-2-name': 'Test 3',
        }

        res = self.client.post('/inlines/{}/'.format(order.id), data)
        self.assertEqual(res.status_code, 302)

        order = Order.objects.get(id=order.id)

        self.assertEqual(3, order.items.count())
        self.assertEqual(2, Tag.objects.count())
        self.assertEqual('Bubble Bath', order.items.all()[0].name)
dataset/ETHPy150Open AndrewIngram/django-extra-views/extra_views_tests/tests.py/ModelWithInlinesTests.test_update/swapped operands of `%`