def check_dimensions(self, instance, width, height,
                             field_name='mugshot'):
            field = getattr(instance, field_name)
            # Check height/width attributes of field.
            if width is None and height is None:
                self.assertRaises(ValueError, getattr, field, 'width')
                self.assertRaises(ValueError, getattr, field, 'height')
            else:
                self.assertEqual(field.width, width)
                self.assertEqual(field.height, height)

            # Check height/width fields of model, if defined.
            width_field_name = field_name + '_width'
            if hasattr(instance, width_field_name):
                self.assertEqual(getattr(instance, width_field_name), width)
            height_field_name = field_name + '_height'
            if hasattr(instance, height_field_name):
                self.assertEqual(getattr(instance, height_field_name), height)
Asserts that the given width and height values match both the
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/tests/regressiontests/model_fields/imagefield.py/ImageFieldTestMixin.check_dimensions