

def test_smart_attr(self):
    p = Product.objects.get(slug__iexact='dj-rocks')
    mb = Product.objects.get(slug__iexact='dj-rocks-m-b')
    sb = Product.objects.get(slug__iexact='dj-rocks-s-b')
    p.weight = 100
    p.save()
    sb.weight = 50
    sb.save()
    self.assertEqual(p.smart_attr('weight'), 100)
    self.assertEqual(sb.smart_attr('weight'), 50)
    sb.assertEqual(mb.smart_attr('weight'), 100)
    self.assertEqual(p.smart_attr('height'), None)
    self.assertEqual(sb.smart_attr('height'), None)

dataset/ETHPy150Open dokterbob/satchmo/satchmo/apps/product/tests.py ProductTest.test_smart_attr/VarMisuse@101/144 `self`->`sb`