Commits

Lenard Lindstrom committed f609acc

White space cleanup on pygame._view related files

Comments (0)

Files changed (5)

     PyObject *rvalue;
     PyObject *parent;
     int failed = 0;
-    
+
     parent = (PyObject *)v->view.obj;
     if (!parent) {
         parent = Py_None;
         }
         strides = shape + ndim;
     }
-    
+
     self = (PgBufferProxyObject *)type->tp_alloc(type, 0);
     if (!self) {
         if (format) {
         self->view.strides = strides;
         memcpy(strides, view->strides, sizeof(Py_ssize_t) * ndim);
     }
-    
+
     self->flags = flags;
     self->prelude = _bufferproxy_null_prelude;
     if (pyprelude) {
 {
     char type = view->format[0];
     char typekind;
-    
+
     switch (type) {
-    
+
     case '<':
     case '>':
     case '=':
         type = view->format[1];
     }
     switch (type) {
-        
+
     case 'c':
     case 'h':
     case 'i':
 {
     char format_0 = view->format[0];
     char byteorder;
-    
+
     switch (format_0) {
-        
+
     case '<':
     case '>':
         byteorder = format_0;
 _as_arrayinter_flags(const Py_buffer *view, int flags)
 {
     int inter_flags = PAI_ALIGNED; /* atomic int types always aligned */
-    
+
     if (!view->readonly) {
         inter_flags |= PAI_WRITEABLE;
     }
     switch (view->format[0]) {
-        
+
     case '<':
         inter_flags |= SDL_BYTEORDER == SDL_LIL_ENDIAN ? PAI_NOTSWAPPED : 0;
         break;
     Py_ssize_t cinter_size;
     CapsuleInterface *cinter_p;
     int i;
-    
+
     cinter_size = (sizeof(CapsuleInterface) +
                    sizeof(Py_intptr_t) * (2 * ndim - 1));
     cinter_p = (CapsuleInterface *)PyMem_Malloc(cinter_size);
 _free_capsuleinterface(void *p)
 {
     CapsuleInterface *cinter_p = (CapsuleInterface *)p;
-    
+
     Py_XDECREF(cinter_p->parent);
     PyMem_Free(p);
 }
 static PyObject *
 _typekind_as_str(PyArrayInterface *inter_p)
 {
-    return Text_FromFormat("%c%c%i", 
+    return Text_FromFormat("%c%c%i",
                            inter_p->itemsize > 1 ?
                                (inter_p->flags & PAI_NOTSWAPPED ?
                                     BUFFERPROXY_MY_ENDIAN :
      */
     Py_ssize_t i, n;
     Py_ssize_t *a;
-    
+
     if (!PyTuple_Check(o)) {
         PyErr_Format(PyExc_TypeError,
                      "Expected a tuple for argument %s: found %s",
 _shape_arg_convert(PyObject *o, void *a)
 {
     Py_buffer *view = (Py_buffer *)a;
-    
+
     if (!_tuple_as_ints(o, "shape", &view->shape, &view->ndim)) {
         return 0;
     }
     char *format;
     PyObject *s;
     const char *typestr;
-    
+
     format = (char *)&view->internal;
     if (PyUnicode_Check(o)) {
         s = PyUnicode_AsASCIIString(o);
     Py_buffer *view = (Py_buffer *)a;
     Py_ssize_t address;
     int readonly;
-    
+
     if (!PyTuple_Check(o)) {
         PyErr_Format(PyExc_TypeError, "expected a tuple for data: got %s",
                      Py_TYPE(o)->tp_name);
 _parent_arg_convert(PyObject *o, void *a)
 {
     Py_buffer *view = (Py_buffer *)a;
-    
+
     if (o != Py_None) {
         view->obj = o;
         Py_INCREF(o);
     /* The argument evaluation order is important: strides must follow shape. */
     char *keywords[] = {"shape", "typestr", "data", "strides", "parent",
                         "prelude", "postscript", 0};
-               
+
     view.obj = 0;
     view.len = 0;
     view.readonly = 1;
     view.suboffsets = 0;
     view.itemsize = 0;
     view.internal = 0;
-    
+
     if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&O&O&|O&O&OO:BufferProxy",
                                      keywords,
                                      _shape_arg_convert, &view,
         return;
     }
     self->prelude = 0;
-    
+
     if (self->global_release) {
         self->postscript((PyObject *)self);
     }
 {
     void *cinter_p;
     PyObject *capsule;
-    
+
     cinter_p = _new_capsuleinterface(&self->view, self->flags);
     if (!cinter_p) {
         return 0;
 _bufferproxy_get_arrayinterface(PgBufferProxyObject *self, PyObject *closure)
 {
     PyObject *dict = Pg_BufferBufferProxyAsDict(&self->view);
-    
+
     if (dict && !self->global_release) {
         if (self->prelude((PyObject *)self)) {
             Py_DECREF(dict);
 _bufferproxy_get_parent(PgBufferProxyObject *self, PyObject *closure)
 {
     PyObject *parent = (PyObject *)self->view.obj;
-    
+
     if (!parent) {
         Py_RETURN_NONE;
     }
 _bufferproxy_get___dict__(PgBufferProxyObject *self, PyObject *closure)
 {
     if (!self->dict) {
-	self->dict = PyDict_New();
+        self->dict = PyDict_New();
         if (!self->dict) {
             return 0;
         }
 _bufferproxy_getbuffer(PyObject *obj, Py_buffer *view, int flags)
 {
     PgBufferProxyObject *v = (PgBufferProxyObject *)obj;
-    
+
     if (flags == PyBUF_SIMPLE && !(v->flags & BUFFERPROXY_CONTIGUOUS)) {
         PyErr_SetString(PyExc_BufferError, "buffer not contiguous");
         return -1;
              !(v->flags & (BUFFERPROXY_CONTIGUOUS | BUFFERPROXY_C_ORDER))) {
         PyErr_SetString(PyExc_BufferError, "buffer not C contiguous");
         return -1;
-    }            
+    }
     if (flags & PyBUF_ANY_CONTIGUOUS &&
-        !(v->flags & (BUFFERPROXY_CONTIGUOUS | 
+        !(v->flags & (BUFFERPROXY_CONTIGUOUS |
                       BUFFERPROXY_C_ORDER |
                       BUFFERPROXY_F_ORDER))) {
         PyErr_SetString(PyExc_BufferError, "buffer not contiguous");
     ((PgBufferProxyObject *)obj)->postscript(obj);
 }
 
-static PyBufferProcs _bufferproxy_bufferprocs = 
+static PyBufferProcs _bufferproxy_bufferprocs =
     {_bufferproxy_getbuffer, _bufferproxy_releasebuffer};
 #endif
 
 {
     PyObject *parent =
         (PyObject *)((PgBufferProxyObject *) bufferproxy)->view.obj;
-    
+
     if (!parent) {
         parent = Py_None;
     }
 /*
   pygame - Python Game Library
   Copyright (C) 2000-2001  Pete Shinners
-  Copyright (C) 2007  Rene Dudfield, Richard Goedeken 
+  Copyright (C) 2007  Rene Dudfield, Richard Goedeken
 
   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
 /* Bufferproxy flags */
 #define BUFFERPROXY_CONTIGUOUS    1
 #define BUFFERPROXY_C_ORDER       2
-#define BUFFERPROXY_F_ORDER       4 
+#define BUFFERPROXY_F_ORDER       4
 
 #define PYGAMEAPI_VIEW_NUMSLOTS 5
 #define PYGAMEAPI_VIEW_FIRSTSLOT 0
 }
 
 /* surface object internals */
-static void 
+static void
 surface_cleanup (PySurfaceObject *self)
 {
     if (self->surf) {
     }
 }
 
-static void 
+static void
 surface_dealloc (PyObject *self)
 {
     if (((PySurfaceObject *) self)->weakreflist)
     return Text_FromUTF8 (str);
 }
 
-static intptr_t 
+static intptr_t
 surface_init (PySurfaceObject *self, PyObject *args, PyObject *kwds)
 {
     Uint32 flags = 0;
        return -1;
 
     if (PySequence_Check (size) && (length = PySequence_Length (size)) == 2) {
-        if ( (!IntFromObjIndex (size, 0, &width)) || 
+        if ( (!IntFromObjIndex (size, 0, &width)) ||
              (!IntFromObjIndex (size, 1, &height)) ) {
             RAISE (PyExc_ValueError, "size needs to be (int width, int height)");
             return -1;
         RAISE (PyExc_SDLError, SDL_GetError ());
         return -1;
     }
-    
+
     if (masks) {
     /* Confirm the surface was created correctly (masks were valid).
        Also ensure that 24 and 32 bit surfaces have 8 bit fields
         self->surf = surface;
         self->subsurface = NULL;
     }
-    
+
     return 0;
 }
 
     tuple = PyTuple_New (len);
     if (!tuple)
         return NULL;
-    
+
     for (i = 0; i < len; i++) {
         tmp = PyWeakref_GetObject (PyList_GetItem (surf->locklist, i));
         Py_INCREF (tmp);
         return RAISE (PyExc_ValueError,
                       "takes a sequence of integers of RGB for argument 2");
     }
-    
+
     if (!pal) {
         PyErr_SetString (PyExc_SDLError, "Surface is not palettized\n");
         return NULL;
 
 
         if (blendargs != 0) {
-            
-            /* 
+
+            /*
             printf ("Using blendargs: %d\n", blendargs);
             */
             result = surface_fill_blend (surf, &sdlrect, color, blendargs);
     if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i", kwids, &min_alpha))
        return RAISE (PyExc_ValueError,
                      "get_bounding_rect only accepts a single optional min_alpha argument");
-    
+
     if (!surf)
         return RAISE (PyExc_SDLError, "display Surface quit");
 
                      surf->format,
                      &keyr, &keyg, &keyb, &a);
     }
-    
+
     pixels = (Uint8 *) surf->pixels;
-    
+
     min_y = 0;
     min_x = 0;
     max_x = surf->w;
         return RAISE (PyExc_SDLError,
             "could not acquire a buffer for the surface");
     }
-    
+
     lock = PySurface_LockLifetime (self, buffer);
     if (!lock) {
         Py_DECREF (buffer);
                      " unknown view kind %d", (int) kind);
         return 0;
     }
-    PyErr_Format(PyExc_ValueError, 
+    PyErr_Format(PyExc_ValueError,
          "unsupported bit depth %d for %s reference array",
                  bitsize, name);
     return 0;
     Uint32 mask = 0;
     int pixelstep;
     int flags = 0;
-    
+
     char *keywords[] = {"kind", 0};
 
     if (!PyArg_ParseTupleAndKeywords (args, kwds, "|O&", keywords,
     view.format = format;
     view.suboffsets = 0;
     view.internal = 0;
-    
+
     startpixel = surface->pixels;
     pixelsize = surface->format->BytesPerPixel;
     shape[0] = (Py_ssize_t)surface->w;
     view.buf = startpixel;
     view.itemsize = itemsize;
     switch (itemsize) {
-    
+
     case 1:
         break; /* default */
     case 2:
 {
     PyObject *surf = PgBufferProxy_GetParent (view);
     int rcode;
-    
+
     rcode = PySurface_LockBy (surf, view) ? 0 : -1;
     Py_DECREF (surf);
     return rcode;
 _view_postscript (PyObject *view)
 {
     PyObject *surf = PgBufferProxy_GetParent(view);
-    
+
     PySurface_UnlockBy (surf, view);
     Py_DECREF (surf);
 }
     }
 
     span = w * src->format->BytesPerPixel;
-    
+
     if (dstpixels >= srcpixels + (h - 1) * src->pitch + span) {
         return 0;
     }
 }
 
 /*this internal blit function is accessable through the C api*/
-int 
+int
 PySurface_Blit (PyObject * dstobj, PyObject * srcobj, SDL_Rect * dstrect,
                 SDL_Rect * srcrect, int the_args)
 {
     PyObject *module, *dict, *apiobj, *lockmodule;
     int ecode;
     static void* c_api[PYGAMEAPI_SURFACE_NUMSLOTS];
-    
+
 #if PY3
     static struct PyModuleDef _module = {
         PyModuleDef_HEAD_INIT,
 
         if (PyCapsule_CheckExact (_c_api)) {
             int i;
-            void **localptr = 
+            void **localptr =
                 (void *)PyCapsule_GetPointer (_c_api,
                                               PG_CAPSULE_NAME("surflock"));
 
     if (PyType_Ready(&PySurface_Type) < 0) {
         MODINIT_ERROR;
     }
-    
+
     /* create the module */
 #if PY3
     module = PyModule_Create (&_module);

test/_view_test.py

         p = []
         v = BufferProxy(parent=p, **self.view_keywords)
         self.assert_(v.parent is p)
-    
+
     def test_prelude(self):
         def callback(parent):
             success.append(parent is p)
             raise MyException("Just a test.")
 
         p = []
-        
+
         # For array interface
         success = []
         v = BufferProxy(parent=p, prelude=callback, **self.view_keywords)
         c = v = None
         gc.collect()
         self.assertEqual(len(success), 1)
-        
+
         # Callback raises an exception
         v = BufferProxy(prelude=raise_exception, **self.view_keywords)
         self.assertRaises(MyException, lambda : v.__array_struct__)
             success.append(parent is p)
 
         p = []
-        
+
         # For array interface
         success = []
         v = BufferProxy(parent=p, postscript=callback, **self.view_keywords)
         gc.collect()
         self.assertTrue(weak_r0() is None)
         self.assertTrue(weak_r1() is None)
-        
+
     def test_c_api(self):
         api = pygame._view._PYGAME_C_API
         self.assert_(isinstance(api, type(pygame.base._PYGAME_C_API)))
 
           # The raw buffer data as string. The string may contain NUL bytes.
 
-        self.fail() 
+        self.fail()
 
     def todo_test_write(self):
 
         # __doc__ (as of 2008-08-02) for pygame.bufferproxy.BufferProxy.write:
 
           # B.write (bufferproxy, buffer, offset) -> None
-          # 
+          #
           # Writes raw data to the bufferproxy.
-          # 
+          #
           # Writes the raw data from buffer to the BufferProxy object, starting
           # at the specified offset within the BufferProxy.
           # If the length of the passed buffer exceeds the length of the
           # BufferProxy (reduced by the offset), an IndexError will be raised.
 
-        self.fail() 
-        
+        self.fail()
+
 
 if __name__ == '__main__':
     unittest.main()

test/surface_test.py

         surf = pygame.Surface((70,70), flags=SRCALPHA, depth=32)
         self.assertEqual(surf.get_flags() & SRCALPHA, SRCALPHA)
         self.assertEqual(surf.get_bitsize(), 32)
-        
+
         # sanity check to make sure the check below is valid
         surf_16 = pygame.Surface((70,70), 0, 16)
         self.assertEqual(surf_16.get_bytesize(), 2)
-        
+
         # try again with an argument list
         surf_16 = pygame.Surface((70,70), depth=16)
         self.assertEqual(surf_16.get_bytesize(), 2)
 
     def test_set_at(self):
 
-        #24bit surfaces 
+        #24bit surfaces
         s = pygame.Surface( (100, 100), 0, 24)
         s.fill((0,0,0))
 
         # What contiguous bits in a mask.
         masks = (0x6F0000, 0xFF00, 0xFF, 0)
         self.failUnlessRaises(ValueError, make_surf, 32, 0, masks)
-        
+
     def test_get_buffer (self):
         surf = pygame.Surface ((70, 70), 0, 32)
         buf = surf.get_buffer ()
         self.assertEqual(bound_rect.top, 29)
         self.assertEqual(bound_rect.width, 2)
         self.assertEqual(bound_rect.height, 2)
-        
+
         surf = pygame.Surface ((70, 70), 0, 24)
         surf.fill((0,0,0))
         bound_rect = surf.get_bounding_rect()
 
           # Surface.copy(): return Surface
           # create a new copy of a Surface
-        
+
         color = (25, 25, 25, 25)
         s1 = pygame.Surface((32,32), pygame.SRCALPHA, 32)
         s1.fill(color)
-        
+
         s2 = s1.copy()
-        
+
         s1rect = s1.get_rect()
         s2rect = s2.get_rect()
-        
+
         self.assert_(s1rect.size == s2rect.size)
         self.assert_(s2.get_at((10,10)) == color)
 
 
           # Surface.fill(color, rect=None, special_flags=0): return Rect
           # fill Surface with a solid color
-        
+
         color = (25, 25, 25, 25)
         fill_rect = pygame.Rect(0, 0, 16, 16)
-        
+
         s1 = pygame.Surface((32,32), pygame.SRCALPHA, 32)
-        s1.fill(color, fill_rect)   
-        
+        s1.fill(color, fill_rect)
+
         for pt in test_utils.rect_area_pts(fill_rect):
             self.assert_(s1.get_at(pt) == color )
-        
+
         for pt in test_utils.rect_outer_bounds(fill_rect):
             self.assert_(s1.get_at(pt) != color )
 
         color = (25, 25, 25, 25)
         color2 = (20, 20, 20, 25)
         fill_rect = pygame.Rect(-10, -10, 16, 16)
-        
+
         s1 = pygame.Surface((32,32), pygame.SRCALPHA, 32)
-        r1 = s1.fill(color, fill_rect)   
+        r1 = s1.fill(color, fill_rect)
         c = s1.get_at((0,0))
         self.assertEqual(c, color)
 
         s1.fill(special_flags=pygame.BLEND_ADD, color=color, rect=area)
         self.assert_(s1.get_at((0, 0)) == (0, 0, 0, 255))
         self.assert_(s1.get_at((1, 1)) == color)
-                     
+
     ########################################################################
 
     def test_get_alpha(self):
 
         s1 = pygame.Surface((32,32), pygame.SRCALPHA, 32)
         self.assert_(s1.get_alpha() == 255)
-        
+
         for alpha in (0, 32, 127, 255):
             s1.set_alpha(alpha)
             for t in range(4): s1.set_alpha(s1.get_alpha())
             self.assert_(s1.get_alpha() == alpha)
-                
+
     ########################################################################
-    
+
     def test_get_bytesize(self):
 
         # __doc__ (as of 2008-06-25) for pygame.surface.Surface.get_bytesize:
 
           # Surface.get_bytesize(): return int
           # get the bytes used per Surface pixel
-        
+
         s1 = pygame.Surface((32,32), pygame.SRCALPHA, 32)
         self.assert_(s1.get_bytesize() == 4)
         self.assert_(s1.get_bitsize() == 32)
 
           # Surface.get_flags(): return int
           # get the additional flags used for the Surface
-        
+
         s1 = pygame.Surface((32,32), pygame.SRCALPHA, 32)
         self.assert_(s1.get_flags() == pygame.SRCALPHA)
 
-    
+
     ########################################################################
-    
+
     def test_get_parent(self):
 
         # __doc__ (as of 2008-06-25) for pygame.surface.Surface.get_parent:
         parent = pygame.Surface((16, 16))
         child = parent.subsurface((0,0,5,5))
 
-        self.assert_(child.get_parent() is parent) 
-        
+        self.assert_(child.get_parent() is parent)
+
     ########################################################################
 
     def test_get_rect(self):
 
           # Surface.get_rect(**kwargs): return Rect
           # get the rectangular area of the Surface
-        
+
         surf = pygame.Surface((16, 16))
-        
+
         rect = surf.get_rect()
-        
+
         self.assert_(rect.size == (16, 16))
 
     ########################################################################
 
           # Surface.get_width(): return width
           # get the width of the Surface
-        
+
         for w in xrange_(0, 255, 32):
             for h in xrange_(0, 127, 15):
                 s = pygame.Surface((w, h))
-                self.assertEquals(s.get_width(), w) 
-                self.assertEquals(s.get_height(), h) 
+                self.assertEquals(s.get_width(), w)
+                self.assertEquals(s.get_height(), h)
                 self.assertEquals(s.get_size(), (w, h))
 
     def test_get_view(self):
         s = pygame.Surface((2, 4), 0, 32)
         s.get_view(as_unicode('2'))
         s.get_view(as_bytes('2'))
-        
+
         # Garbage collection
         s = pygame.Surface((2, 4), 0, 32)
         weak_s = weakref.ref(s)
           # Surface.set_colorkey(Color, flags=0): return None
           # Surface.set_colorkey(None): return None
           # Set the transparent colorkey
-        
+
         s = pygame.Surface((16,16), pygame.SRCALPHA, 32)
-        
+
         colorkeys = ((20,189,20, 255),(128,50,50,255), (23, 21, 255,255))
 
         for colorkey in colorkeys:
             s.set_colorkey(colorkey)
             for t in range(4): s.set_colorkey(s.get_colorkey())
-            self.assertEquals(s.get_colorkey(), colorkey) 
+            self.assertEquals(s.get_colorkey(), colorkey)
 
 
 
         s.set_shifts((b,g,r,a))
         r2,g2,b2,a2 = s.get_shifts()
         self.assertEqual((r,g,b,a), (b2,g2,r2,a2))
-    
+
     def test_blit_keyword_args(self):
         color = (1, 2, 3, 255)
         s1 = pygame.Surface((4, 4), 0, 32)
           # any pixels outside the destination Surface, or outside the clipping
           # area.
           #
-          # Pixel alphas will be ignored when blitting to an 8 bit Surface. 
-          # special_flags new in pygame 1.8. 
+          # Pixel alphas will be ignored when blitting to an 8 bit Surface.
+          # special_flags new in pygame 1.8.
 
         self.fail()
 
 
         for pt, color in test_utils.gradient(rect.width, rect.height):
             src.set_at(pt, color)
-        
+
         src.blit(src, (0, 0))
-        
+
     def todo_test_blit__SRCALPHA_to_SRCALPHA_non_zero(self): #TODO
         # " There is no unit test for blitting a SRCALPHA source with non-zero
         #   alpha to a SRCALPHA destination with non-zero alpha " LL
           # Surface.convert(masks, flags=0): return Surface
           # Surface.convert(): return Surface
           # change the pixel format of an image
-          # 
+          #
           # Creates a new copy of the Surface with the pixel format changed. The
           # new pixel format can be determined from another existing Surface.
           # Otherwise depth, flags, and masks arguments can be used, similar to
           # the pygame.Surface() call.
-          # 
+          #
           # If no arguments are passed the new Surface will have the same pixel
           # format as the display Surface. This is always the fastest format for
           # blitting. It is a good idea to convert all Surfaces before they are
           # blitted many times.
-          # 
+          #
           # The converted Surface will have no pixel alphas. They will be
           # stripped if the original had them. See Surface.convert_alpha() for
           # preserving or creating per-pixel alphas.
-          # 
+          #
 
-        self.fail() 
+        self.fail()
 
     def todo_test_convert_alpha(self):
 
           # Surface.convert_alpha(Surface): return Surface
           # Surface.convert_alpha(): return Surface
           # change the pixel format of an image including per pixel alphas
-          # 
+          #
           # Creates a new copy of the surface with the desired pixel format. The
           # new surface will be in a format suited for quick blitting to the
           # given format with per pixel alpha. If no surface is given, the new
           # surface will be optimized for blitting to the current display.
-          # 
+          #
           # Unlike the Surface.convert() method, the pixel format for the new
           # image will not be exactly the same as the requested source, but it
           # will be optimized for fast alpha blitting to the destination.
-          # 
+          #
 
-        self.fail() 
+        self.fail()
 
     def todo_test_get_abs_offset(self):
 
 
           # Surface.get_abs_offset(): return (x, y)
           # find the absolute position of a child subsurface inside its top level parent
-          # 
+          #
           # Get the offset position of a child subsurface inside of its top
           # level parent Surface. If the Surface is not a subsurface this will
           # return (0, 0).
-          # 
+          #
 
-        self.fail() 
+        self.fail()
 
     def todo_test_get_abs_parent(self):
 
 
           # Surface.get_abs_parent(): return Surface
           # find the top level parent of a subsurface
-          # 
+          #
           # Returns the parent Surface of a subsurface. If this is not a
           # subsurface then this surface will be returned.
-          # 
+          #
 
-        self.fail() 
+        self.fail()
 
     def test_get_at(self):
         surf = pygame.Surface((2, 2), 0, 24)
 
           # Surface.get_bitsize(): return int
           # get the bit depth of the Surface pixel format
-          # 
+          #
           # Returns the number of bits used to represent each pixel. This value
           # may not exactly fill the number of bytes used per pixel. For example
           # a 15 bit Surface still requires a full 2 bytes.
-          # 
+          #
 
-        self.fail() 
+        self.fail()
 
     def todo_test_get_clip(self):
 
 
           # Surface.get_clip(): return Rect
           # get the current clipping area of the Surface
-          # 
+          #
           # Return a rectangle of the current clipping area. The Surface will
           # always return a valid rectangle that will never be outside the
           # bounds of the image. If the Surface has had None set for the
           # clipping area, the Surface will return a rectangle with the full
           # area of the Surface.
-          # 
+          #
 
-        self.fail() 
+        self.fail()
 
     def todo_test_get_colorkey(self):
         surf = pygame.surface((2, 2), 0, 24)
 
           # Surface.get_height(): return height
           # get the height of the Surface
-          # 
-          # Return the height of the Surface in pixels. 
+          #
+          # Return the height of the Surface in pixels.
 
-        self.fail() 
+        self.fail()
 
     def todo_test_get_locked(self):
 
 
           # Surface.get_locked(): return bool
           # test if the Surface is current locked
-          # 
+          #
           # Returns True when the Surface is locked. It doesn't matter how many
           # times the Surface is locked.
-          # 
+          #
 
-        self.fail() 
+        self.fail()
 
     def todo_test_get_locks(self):
 
 
           # Surface.get_locks(): return tuple
           # Gets the locks for the Surface
-          # 
-          # Returns the currently existing locks for the Surface. 
+          #
+          # Returns the currently existing locks for the Surface.
 
-        self.fail() 
+        self.fail()
 
     def todo_test_get_losses(self):
 
 
           # Surface.get_losses(): return (R, G, B, A)
           # the significant bits used to convert between a color and a mapped integer
-          # 
+          #
           # Return the least significant number of bits stripped from each color
           # in a mapped integer.
-          # 
-          # This value is not needed for normal Pygame usage. 
+          #
+          # This value is not needed for normal Pygame usage.
 
-        self.fail() 
+        self.fail()
 
     def todo_test_get_masks(self):
 
 
           # Surface.get_masks(): return (R, G, B, A)
           # the bitmasks needed to convert between a color and a mapped integer
-          # 
-          # Returns the bitmasks used to isolate each color in a mapped integer. 
-          # This value is not needed for normal Pygame usage. 
+          #
+          # Returns the bitmasks used to isolate each color in a mapped integer.
+          # This value is not needed for normal Pygame usage.
 
-        self.fail() 
+        self.fail()
 
     def todo_test_get_offset(self):
 
 
           # Surface.get_offset(): return (x, y)
           # find the position of a child subsurface inside a parent
-          # 
+          #
           # Get the offset position of a child subsurface inside of a parent. If
           # the Surface is not a subsurface this will return (0, 0).
-          # 
+          #
 
-        self.fail() 
+        self.fail()
 
     def test_get_palette(self):
         pygame.init()
 
           # Surface.get_pitch(): return int
           # get the number of bytes used per Surface row
-          # 
+          #
           # Return the number of bytes separating each row in the Surface.
           # Surfaces in video memory are not always linearly packed. Subsurfaces
           # will also have a larger pitch than their real width.
-          # 
-          # This value is not needed for normal Pygame usage. 
+          #
+          # This value is not needed for normal Pygame usage.
 
-        self.fail() 
+        self.fail()
 
     def todo_test_get_shifts(self):
 
 
           # Surface.get_shifts(): return (R, G, B, A)
           # the bit shifts needed to convert between a color and a mapped integer
-          # 
+          #
           # Returns the pixel shifts need to convert between each color and a
           # mapped integer.
-          # 
-          # This value is not needed for normal Pygame usage. 
+          #
+          # This value is not needed for normal Pygame usage.
 
-        self.fail() 
+        self.fail()
 
     def todo_test_get_size(self):
 
 
           # Surface.get_size(): return (width, height)
           # get the dimensions of the Surface
-          # 
-          # Return the width and height of the Surface in pixels. 
+          #
+          # Return the width and height of the Surface in pixels.
 
-        self.fail() 
+        self.fail()
 
     def todo_test_lock(self):
 
 
           # Surface.lock(): return None
           # lock the Surface memory for pixel access
-          # 
+          #
           # Lock the pixel data of a Surface for access. On accelerated
           # Surfaces, the pixel data may be stored in volatile video memory or
           # nonlinear compressed forms. When a Surface is locked the pixel
           # memory becomes available to access by regular software. Code that
           # reads or writes pixel values will need the Surface to be locked.
-          # 
+          #
           # Surfaces should not remain locked for more than necessary. A locked
           # Surface can often not be displayed or managed by Pygame.
-          # 
+          #
           # Not all Surfaces require locking. The Surface.mustlock() method can
           # determine if it is actually required. There is no performance
           # penalty for locking and unlocking a Surface that does not need it.
-          # 
+          #
           # All pygame functions will automatically lock and unlock the Surface
           # data as needed. If a section of code is going to make calls that
           # will repeatedly lock and unlock the Surface many times, it can be
           # helpful to wrap the block inside a lock and unlock pair.
-          # 
+          #
           # It is safe to nest locking and unlocking calls. The surface will
           # only be unlocked after the final lock is released.
-          # 
+          #
 
-        self.fail() 
+        self.fail()
 
     def test_map_rgb(self):
         color = Color(0, 128, 255, 64)
 
           # Surface.mustlock(): return bool
           # test if the Surface requires locking
-          # 
+          #
           # Returns True if the Surface is required to be locked to access pixel
           # data. Usually pure software Surfaces do not require locking. This
           # method is rarely needed, since it is safe and quickest to just lock
           # all Surfaces as needed.
-          # 
+          #
           # All pygame functions will automatically lock and unlock the Surface
           # data as needed. If a section of code is going to make calls that
           # will repeatedly lock and unlock the Surface many times, it can be
           # helpful to wrap the block inside a lock and unlock pair.
-          # 
+          #
 
-        self.fail() 
+        self.fail()
 
     def todo_test_set_alpha(self):
 
           # Surface.set_alpha(value, flags=0): return None
           # Surface.set_alpha(None): return None
           # set the alpha value for the full Surface image
-          # 
+          #
           # Set the current alpha value fo r the Surface. When blitting this
           # Surface onto a destination, the pixels will be drawn slightly
           # transparent. The alpha value is an integer from 0 to 255, 0 is fully
           # transparent and 255 is fully opaque. If None is passed for the alpha
           # value, then the Surface alpha will be disabled.
-          # 
+          #
           # This value is different than the per pixel Surface alpha. If the
           # Surface format contains per pixel alphas, then this alpha value will
           # be ignored. If the Surface contains per pixel alphas, setting the
           # alpha value to None will disable the per pixel transparency.
-          # 
+          #
           # The optional flags argument can be set to pygame.RLEACCEL to provide
           # better performance on non accelerated displays. An RLEACCEL Surface
           # will be slower to modify, but quicker to blit as a source.
-          # 
+          #
 
         s = pygame.Surface((1,1), SRCALHPA, 32)
         s.fill((1, 2, 3, 4))
         s.set_alpha(None)
         self.failUnlessEqual(s.get_at((0, 0)), (1, 2, 3, 255))
-        self.fail() 
+        self.fail()
 
     def test_set_palette(self):
         palette = [pygame.Color(i, i, i) for i in range(256)]
 
           # Surface.subsurface(Rect): return Surface
           # create a new surface that references its parent
-          # 
+          #
           # Returns a new Surface that shares its pixels with its new parent.
           # The new Surface is considered a child of the original. Modifications
           # to either Surface pixels will effect each other. Surface information
           # like clipping area and color keys are unique to each Surface.
-          # 
+          #
           # The new Surface will inherit the palette, color key, and alpha
           # settings from its parent.
-          # 
+          #
           # It is possible to have any number of subsurfaces and subsubsurfaces
           # on the parent. It is also possible to subsurface the display Surface
           # if the display mode is not hardware accelerated.
-          # 
+          #
           # See the Surface.get_offset(), Surface.get_parent() to learn more
           # about the state of a subsurface.
-          # 
+          #
 
         surf = pygame.Surface((16, 16))
         s = surf.subsurface(0,0,1,1)
 
           # Surface.unlock(): return None
           # unlock the Surface memory from pixel access
-          # 
+          #
           # Unlock the Surface pixel data after it has been locked. The unlocked
           # Surface can once again be drawn and managed by Pygame. See the
           # Surface.lock() documentation for more details.
-          # 
+          #
           # All pygame functions will automatically lock and unlock the Surface
           # data as needed. If a section of code is going to make calls that
           # will repeatedly lock and unlock the Surface many times, it can be
           # helpful to wrap the block inside a lock and unlock pair.
-          # 
+          #
           # It is safe to nest locking and unlocking calls. The surface will
           # only be unlocked after the final lock is released.
-          # 
+          #
 
-        self.fail() 
+        self.fail()
 
     def test_unmap_rgb(self):
         # Special case, 8 bit-per-pixel surface (has a palette).
         self.assertEqual(inter.strides[1], s_pitch)
         self.assertEqual(inter.flags, flags)
         self.assertEqual(inter.data, s_pixels + offset);
-        
+
     def test_array_interface(self):
         self._check_interface_2D(pygame.Surface((5, 7), 0, 8))
         self._check_interface_2D(pygame.Surface((5, 7), 0, 16))
         dst = self._make_surface(32, srcalpha=True)
         dst.blit(src, (0, 0), special_flags=BLEND_RGBA_ADD)
         self.failUnlessEqual(dst.get_at((0, 0)), (0, 0, 0, 255))
-        
+
     def test_fill_blend(self):
         destinations = [self._make_surface(8),
                         self._make_surface(16),
                     (255, 0, 0, 0),
                     (0, 255, 0, 255)]
     surf_size = (9, 6)
-    
+
     def _fill_surface(self, surf, palette=None):
         if palette is None:
             palette = self._test_palette
                 surf.fill(rectc_left, (0, 0, 25, 50))
                 surf.blit(surf, (d_x, d_y), (s_x, s_y, 50, 50))
                 self.failUnlessEqual(surf.get_at(test_posn), rectc_right)
-         
+
     def test_colorkey(self):
         # Check a workaround for an SDL 1.2.13 surface self-blit problem
         # (MotherHamster Bugzilla bug 19).