def test_reordered(self):
        p = Product.objects.get(slug='dj-rocks')

        pv = p.configurableproduct.productvariation_set.all()[0]
        orig_key = pv.optionkey
        orig_detl = productvariation_details(p, False, None, create=True)

        sizegroup = OptionGroup.objects.get(name="sizes")
        sizegroup.sort_order = 100
        sizegroup.save()

        # reverse ordering
        for opt in sizegroup.option_set.all():
            opt.sort_order = opt.sort_order-100
            opt.save()

        serialized = serialize_options(p.configurableproduct)
        self.assert_(len(serialized), 2)
        self.assertEqual(serialized[1]['id'], 1)
        got_vals = [opt.value for opt in serialized[1]['items']]
        self.assertEqual(got_vals, ['L','M','S'])

        pv2 = ProductVariation.objects.get(pk=pv.pk)
        self.assertEqual(orig_key, pv2.optionkey)
        reorder_detl = productvariation_details(p, False, None)
        self.assertEqual(orig_detl, reorder_detl)
dataset/ETHPy150Open dokterbob/satchmo/satchmo/apps/product/modules/configurable/tests.py/OptionUtilsTest.test_reordered/swapped operands of `-`