Commits

Anonymous committed b271b91

Fixed define macros for build systems.
Fixed minor type detection issue in sdl.video.Surface.save.
Changed doc text wrapping for test generator.

Comments (0)

Files changed (16)

 * Rewrite and fix up numpysurfarray and numpysndarray
 * Add prebuilt package for Win32 VC++ builds.
 * Refine quitting for SDL_QuitSubSystem wrapper.
-* Rewrite RWops wrapper code to make it suitable for buffer-like objects and
-  to avoid unnecessary closes.
 
 Things to ADD:
 ==============

config/config_generic.py

         The process of 'configuring' this Dependency implies setting the
         following lists with the information relevant to the library:
             
-            self.incdirs (all the directories which contain the include files)
-            self.libdirs (the directory(s) which contain the library itself)
-            self.libs    (the name of the library files which must be linked)
-            self.cflags  (all the flags which must be passed to the C compiler)
-            self.lflags  (all the flags which must be passed to the C linker)
+            self.incdirs  (all the directories which contain the include files)
+            self.libdirs  (the directory(s) which contain the library itself)
+            self.libs     (the name of the library files which must be linked)
+            self.cflags   (all the flags which must be passed to the C compiler)
+            self.gdefines (all the defines which to be passed to the C compiler)
+            self.lflags   (all the flags which must be passed to the C linker)
 
         Configuration is done by executing 'configuration callbacks'
         (each one implementing a different configuration method) until
         self.libs = [self.library_id]
         self.cflags = []
         self.lflags = []
+        self.gdefines = []
 
         self.configured = False
 
 
         self.incdirs.extend(dirs)
         self.libdirs.append(libdir)
-        self.cflags.append("-DHAVE_" + self.library_id.upper())
         return True
 
     _configure_guess.priority = 0
                 self.incdirs = list(set(self.incdirs))
                 self.libdirs = list(set(self.libdirs))
                 self.libs = list(set(self.libs))
+                self.gdefines.append(("HAVE_" + self.library_id.upper(), None))
 
                 print ("")
                 print ("\tCFlags : " + repr(self.cflags))
         module.lflags += self.lflags
         module.incdirs += self.incdirs
         module.libdirs += self.libdirs
+        module.globaldefines += self.gdefines 
         module.libs += self.libs
 import create_cref
 
 class Module:
-    def __init__ (self, name, sources=None, instheaders=[], docfile=None, depends=None, optional_dep=None):
+    def __init__ (self, name, sources=None, instheaders=[], docfile=None,
+                  depends=None, optional_dep=None):
         """
             Initializes the Module object.
 
                         module depends.
                         These libraries must be declared beforehand in 
                         config.config_modules.DEPENDENCIES
-            optional_dep - List of optional libraries with which this module can be built.
+            optional_dep - List of optional libraries with which this module
+                           can be built.
         """
 
         self.name = name
         self.docfile = docfile
         self.canbuild = True
         nn = name.upper ().replace (".", "_")
-        self.cflags_avail = "-DHAVE_PYGAME_" + nn
+        self.globaldefines = [("HAVE_PYGAME_" + nn, None)]
 
         self.depends = list (depends or [])
         self.optional_dep = list(optional_dep or [])
 
     config.config_modules.prepare_modules (buildsystem, modules, cfg)
     
-    allmodcflags = []
+    alldefines = []
     for mod in modules:
-        # Build the availability cflags
+        # Build the availability defines
         if mod.canbuild:
-            allmodcflags += [ mod.cflags_avail ]
-
+            for entry in mod.globaldefines:
+                if entry not in alldefines:
+                    alldefines.append (entry)
+    
     # Create the extensions
     for mod in modules:
         if not mod.canbuild:
             print ("Skipping module '%s'" % mod.name)
             continue
         ext = Extension ("pygame2." + mod.name, sources=mod.sources)
-        ext.extra_compile_args = [ "-DPYGAME_INTERNAL" ] + mod.cflags + \
-                                 allmodcflags
+        ext.define_macros.append (("PYGAME_INTERNAL", None))
+        for entry in alldefines:
+            ext.define_macros.append (entry)
+        ext.extra_compile_args = mod.cflags
         ext.extra_link_args = mod.lflags
         ext.include_dirs = mod.incdirs + [ baseincpath, compatpath, docpath ]
         ext.library_dirs = mod.libdirs
                          "installed." % PYTHON_MINIMUM)
 
     buildsystem = None
-    buildcflags = None
+    builddefines = []
     if sys.platform == "win32":
         if msys.is_msys ():
             buildsystem = "msys"
-            buildcflags = "-DIS_MSYS"
+            builddefines.append (("IS_MSYS", None))
         else:
             buildsystem = "win"
-            buildcflags = "-DIS_WIN32"
+            builddefines.append (("IS_WIN32", None))
     elif sys.platform == "darwin":
         buildsystem = "darwin"
-        buildcflags = "-DIS_DARWIN"
+        builddefines.append (("IS_DARWIN", None))
     else:
         buildsystem = "unix"
-        buildcflags = "-DIS_UNIX"
+        builddefines.append (("IS_UNIX", None))
 
     if cfg.build['SDL']:
         sdlversion = config_modules.sdl_get_version (buildsystem)
     print ("\t Python: %d.%d.%d" % helpers.getversion ())
     if cfg.build['SDL']:
         print ("\t SDL:    %s" % sdlversion)
-    return buildsystem, buildcflags
+    return buildsystem, builddefines
 
 if __name__ == "__main__":
 
     buildsystem = None
     buildcflags = None
     try:
-        buildsystem, buildcflags = run_checks ()
+        buildsystem, builddefines = run_checks ()
     except:
         print (helpers.geterror ())
         print (helpers.gettraceback ())
     headerfiles = []
     print ("The following modules will be built:")
     for ext in ext_modules:
-        ext.extra_compile_args.append (buildcflags)
+        ext.define_macros.extend (builddefines)
         headerfiles += ext.basemodule.installheaders
         print ("\t%s" % ext.name)
 
         goto fail;
 
     doing = "init IO";
-    png_set_write_fn (png_ptr, rw, png_write_data, NULL);
+    png_set_write_fn (png_ptr, rw, _write_data, NULL);
 
     doing = "write header";
     png_set_IHDR (png_ptr, info_ptr, (png_uint_32)w, (png_uint_32)h,
 
     if (alpha)
     {
-        r = _write_png (file, ss_rows, surface->w, surface->h,
+        r = _write_png (rw, ss_rows, surface->w, surface->h,
             PNG_COLOR_TYPE_RGB_ALPHA, 8);
     }
     else
     {
-        r = _write_png (file, ss_rows, surface->w, surface->h,
+        r = _write_png (rw, ss_rows, surface->w, surface->h,
             PNG_COLOR_TYPE_RGB, 8);
     }
 

src/sdl/surface.c

     rw = PyRWops_NewRW (file, &autoclose);
     if (!rw)
         return NULL;
-    
+
+    if (IsTextObj (file) && !type)
+    {
+        char *filename;
+        size_t len;
+        PyObject *tmp;
+
+        if (!UTF8FromObject (file, &filename, &tmp))
+            return NULL;
+        Py_XDECREF (tmp);
+
+        len = strlen (filename);
+        if (len < 4)
+        {
+            PyErr_SetString (PyExc_PyGameError, "unknown file type");
+            return NULL;
+        }
+        type = filename + (len - 3);
+    }
+
     Py_BEGIN_ALLOW_THREADS;
     retval = pyg_sdlsurface_save_rw (surface, rw, type, autoclose);
     Py_END_ALLOW_THREADS;

src/sdl/surface_save.c

         SDL_SetError ("surface argument NULL");
         return 0;
     }
+
+    if (!type)
+    {
+        SDL_SetError ("type argument NULL");
+        return 0;
+    }
+
     if (!rw)
     {
         SDL_SetError ("rw argument NULL");

test/base_color_test.py

         # 
         # Applies a certain gamma value to the Color.
         # 
-        # Color.correct_gamma (gamma) -> Color  Applies a certain gamma value
-        # to the Color.  Applies a certain gamma value to the Color and
-        # returns a new Color with the adjusted RGBA values.
+        # Applies a certain gamma value to the Color and returns a new
+        # Color with the adjusted RGBA values.
 
         self.fail() 
 
         # 
         # Returns the normalized RGBA values of the Color.
         # 
-        # Color.normalize() -> tuple  Returns the normalized RGBA values of
-        # the Color.  Returns the normalized RGBA values of the Color as
-        # floating point values.
+        # Returns the normalized RGBA values of the Color as floating
+        # point values.
         c = Color (255, 255, 255, 255)
         self.assertEquals (c.normalize (), (1.0, 1.0, 1.0, 1.0))
         c = Color (0, 0, 0, 0)

test/base_frect_test.py

         #
         # Creates a Rect from the specified FRect.
         # 
-        # FRect.ceil () -> Rect Creates a Rect from the specified FRect.
         # This creates a Rect using the smallest integral values greater
         # or equal to the FRect floating point values.
         r = FRect (2.1, -2.9, 5.8, 3.01)
         # 
         # Moves the rectangle inside another.
         # 
-        # FRect.clamp (FRect) -> FRect  Moves the rectangle inside another.
         # Returns a new rectangle that is moved to be completely inside the
         # argument FRect. If the rectangle is too large to fit inside, it is
         # centered inside the argument FRect, but its size is not changed.
         # 
         # Crops a rectangle inside another.
         # 
-        # FRect.clip (FRect) -> FRect  Crops a rectangle inside another.
         # Returns a new rectangle that is cropped to be completely inside the
         # argument FRect. If the two rectangles do not overlap to begin with,
         # a FRect with 0 size is returned. Thus it returns the area, in which
         # 
         # Test if one rectangle in a dictionary intersects.
         # 
-        # FRect.collidedict (dict) -> (key, value)  Test if one rectangle in a
-        # dictionary intersects.  Returns the key and value of the first
-        # dictionary value that collides with the FRect. If no collisions are
-        # found, None is returned. They keys of the passed dict must be FRect
-        # objects.
+        # Returns the key and value of the first dictionary value that
+        # collides with the FRect. If no collisions are found, None is
+        # returned. They keys of the passed dict must be FRect objects.
         r = FRect(1, 1, 10, 10)
         r1 = FRect(1, 1, 10, 10)
         r2 = FRect(50, 50, 10, 10)
         # 
         # Test if all rectangles in a dictionary intersect.
         # 
-        # FRect.collidedictall (dict) -> [(key, value), ...]  Test if all
-        # rectangles in a dictionary intersect.  Returns a list of all the key
-        # and value pairs that intersect with the FRect. If no collisions are
-        # found an empty list is returned. They keys of the passed dict must
-        # be FRect objects.
-
+        # Returns a list of all the key and value pairs that intersect
+        # with the FRect. If no collisions are found an empty list is
+        # returned. They keys of the passed dict must be FRect objects.
 
         r = FRect(1, 1, 10, 10)
 
         # 
         # Test if two rectangles overlap.
         # 
-        # FRect.colliderect (FRect) -> bool  Test if two rectangles overlap.
         # Returns true if any portion of either rectangle overlap (except the
         # top+bottom or left+right edges).
         r1 = FRect(1,2,3,4)
         # 
         # Test if one rectangle in a list intersects.
         # 
-        # FRect.collidelist (list) -> index  Test if one rectangle in a list
-        # intersects.  Test whether the rectangle collides with any in a
-        # sequence of rectangles. The index of the first collision found is
-        # returned. If no collisions are found an index of -1 is returned.
+        # Test whether the rectangle collides with any in a sequence of
+        # rectangles. The index of the first collision found is
+        # returned. If no collisions are found an index of -1 is
+        # returned.
 
         r = FRect(1, 1, 10, 10)
         l = [FRect(50, 50, 1, 1), FRect(5, 5, 10, 10), FRect(15, 15, 1, 1)]
         # 
         # Test if all rectangles in a list intersect.
         # 
-        # FRect.collidelistall (list) -> [index, ...]  Test if all rectangles
-        # in a list intersect.  Returns a list of all the indices that contain
-        # rectangles that collide with the FRect. If no intersecting
-        # rectangles are found, an empty list is returned.
+        # Returns a list of all the indices that contain rectangles that
+        # collide with the FRect. If no intersecting rectangles are
+        # found, an empty list is returned.
 
         r = FRect(1, 1, 10, 10)
 
         # 
         # Test if a point is inside a rectangle.
         # 
-        # FRect.collidepoint (x, y) -> bool  Test if a point is inside a
-        # rectangle.  Returns true if the given point is inside the rectangle.
-        # A point along the right or bottom edge is not considered to be
+        # Returns true if the given point is inside the rectangle.  A
+        # point along the right or bottom edge is not considered to be
         # inside the rectangle.
         r = FRect( 1, 2, 3, 4 )
         
         # 
         # Test if one rectangle is inside another.
         # 
-        # FRect.contains (FRect) -> bool  Test if one rectangle is inside
-        # another.  Returns true when the argument rectangle is completely
+        # Returns true when the argument rectangle is completely
         # inside the FRect.
         r = FRect( 1, 2, 3, 4 )
         
         # 
         # Resize and move a rectangle with aspect ratio.
         # 
-        # FRect.fit (FRect) -> FRect  Resize and move a rectangle with aspect
-        # ratio.  Returns a new rectangle that is moved and resized to fit
+        # Returns a new rectangle that is moved and resized to fit
         # another. The aspect ratio of the original FRect is preserved, so the
         # new rectangle may be smaller than the target in either width or
         # height.
         #
         # Creates a Rect from the specified FRect.
         #
-        # FRect.floor () -> Rect Creates a Rect from the specified FRect.
         # This creates a Rect using the largest integral values less than
         # or equal to the FRect floating point values.
         r = FRect (2.1, -2.9, 5.8, 3.01)
         # 
         # Grow or shrink the rectangle size.
         # 
-        # FRect.inflate (x, y) -> FRect  Grow or shrink the rectangle size.
         # Returns a new rectangle with the size changed by the given offset.
         # The rectangle remains centered around its current center. Negative
         # values will shrink the rectangle.
         # 
         # Moves the rectangle.
         # 
-        # FRect.move (x, y) -> FRect  Moves the rectangle.  Returns a new
-        # rectangle that is moved by the given offset. The x and y arguments
-        # can be any integer value, positive or negative.
+        # Returns a new rectangle that is moved by the given offset. The
+        # x and y arguments can be any integer value, positive or
+        # negative.
         r = FRect( 1, 2, 3, 4 )
         move_x = 10
         move_y = 20
         # 
         # Creates a Rect from the specified FRect.
         # 
-        # FRect.round () -> Rect Creates a Rect from the specified FRect.
         # This creates a Rect using the FRect floating point values
         # rounded to the nearest integral value.
         r = FRect (2.1, -2.9, 5.8, 3.01)
         # FRect.trunc () -> Rect
         #
         # Creates a Rect from the specified FRect.
-
-        # FRect.trunc() -> Rect. Creates a Rect from the specified FRect.
+        #
         # This creates a Rect using truncated integral values from the 
         # Frect floating point values.
         r = FRect (-1.57, 2.99, 8.1, 5.77)
         # 
         # Joins two rectangles into one.
         # 
-        # FRect.union (FRect) -> FRect  Joins two rectangles into one.
         # Returns a new rectangle that completely covers the area of the two
         # provided rectangles. There may be area inside the new FRect that is
         # not covered by the originals.

test/base_rect_test.py

         # 
         # Moves the rectangle inside another.
         # 
-        # Rect.clamp (Rect) -> Rect  Moves the rectangle inside another.
         # Returns a new rectangle that is moved to be completely inside the
         # argument Rect. If the rectangle is too large to fit inside, it is
         # centered inside the argument Rect, but its size is not changed.
         # 
         # Crops a rectangle inside another.
         # 
-        # Rect.clip (Rect) -> Rect  Crops a rectangle inside another.  Returns
-        # a new rectangle that is cropped to be completely inside the argument
-        # Rect. If the two rectangles do not overlap to begin with, a Rect
-        # with 0 size is returned. Thus it returns the area, in which both
-        # rects overlap.
+        # Returns a new rectangle that is cropped to be completely
+        # inside the argument Rect. If the two rectangles do not overlap
+        # to begin with, a Rect with 0 size is returned. Thus it returns
+        # the area, in which both rects overlap.
         r1 = Rect( 1, 2, 3, 4 )
         self.assertEqual( Rect( 1, 2, 2, 2 ), r1.clip( Rect(0,0,3,4) ) )
         self.assertEqual( Rect( 2, 2, 2, 4 ), r1.clip( Rect(2,2,10,20) ) )
         # 
         # Test if one rectangle in a dictionary intersects.
         # 
-        # Rect.collidedict (dict) -> (key, value)  Test if one rectangle in a
-        # dictionary intersects.  Returns the key and value of the first
-        # dictionary value that collides with the Rect. If no collisions are
-        # found, None is returned. They keys of the passed dict must be Rect
-        # objects.
+        # Returns the key and value of the first dictionary value that
+        # collides with the Rect. If no collisions are found, None is
+        # returned. They keys of the passed dict must be Rect objects.
 
         r = Rect(1, 1, 10, 10)
         r1 = Rect(1, 1, 10, 10)
         # 
         # Test if all rectangles in a dictionary intersect.
         # 
-        # Rect.collidedictall (dict) -> [(key, value), ...]  Test if all
-        # rectangles in a dictionary intersect.  Returns a list of all the key
-        # and value pairs that intersect with the Rect. If no collisions are
-        # found an empty list is returned. They keys of the passed dict must
-        # be Rect objects.
+        # Returns a list of all the key and value pairs that intersect
+        # with the Rect. If no collisions are found an empty list is
+        # returned. They keys of the passed dict must be Rect objects.
 
         r = Rect(1, 1, 10, 10)
 
         # 
         # Test if one rectangle in a list intersects.
         # 
-        # Rect.collidelist (list) -> index  Test if one rectangle in a list
-        # intersects.  Test whether the rectangle collides with any in a
-        # sequence of rectangles. The index of the first collision found is
-        # returned. If no collisions are found an index of -1 is returned.
+        # Test whether the rectangle collides with any in a sequence of
+        # rectangles. The index of the first collision found is
+        # returned. If no collisions are found an index of -1 is
+        # returned.
 
         r = Rect(1, 1, 10, 10)
         l = [Rect(50, 50, 1, 1), Rect(5, 5, 10, 10), Rect(15, 15, 1, 1)]
         # 
         # Test if all rectangles in a list intersect.
         # 
-        # Rect.collidelistall (list) -> [index, ...]  Test if all rectangles
-        # in a list intersect.  Returns a list of all the indices that contain
-        # rectangles that collide with the Rect. If no intersecting rectangles
-        # are found, an empty list is returned.
+        # Returns a list of all the indices that contain rectangles that
+        # collide with the Rect. If no intersecting rectangles are
+        # found, an empty list is returned.
         r = Rect(1, 1, 10, 10)
 
         l = [
         # 
         # Test if a point is inside a rectangle.
         # 
-        # Rect.collidepoint (x, y) -> bool  Test if a point is inside a
-        # rectangle.  Returns true if the given point is inside the rectangle.
-        # A point along the right or bottom edge is not considered to be
+        # Returns true if the given point is inside the rectangle.  A
+        # point along the right or bottom edge is not considered to be
         # inside the rectangle.
         r = Rect( 1, 2, 3, 4 )
         
         # 
         # Test if two rectangles overlap.
         # 
-        # Rect.colliderect (Rect) -> bool  Test if two rectangles overlap.
         # Returns true if any portion of either rectangle overlap (except the
         # top+bottom or left+right edges).
         r1 = Rect(1,2,3,4)
         # 
         # Test if one rectangle is inside another.
         # 
-        # Rect.contains (Rect) -> bool  Test if one rectangle is inside
-        # another.  Returns true when the argument rectangle is completely
-        # inside the Rect.
+        # Returns true when the argument rectangle is completely inside
+        # the Rect.
         r = Rect( 1, 2, 3, 4 )
         
         self.failUnless( r.contains( Rect( 2, 3, 1, 1 ) ),
         # 
         # Resize and move a rectangle with aspect ratio.
         # 
-        # Rect.fit (Rect) -> Rect  Resize and move a rectangle with aspect
-        # ratio.  Returns a new rectangle that is moved and resized to fit
-        # another. The aspect ratio of the original Rect is preserved, so the
-        # new rectangle may be smaller than the target in either width or
-        # height.
+        # Returns a new rectangle that is moved and resized to fit
+        # another. The aspect ratio of the original Rect is preserved,
+        # so the new rectangle may be smaller than the target in either
+        # width or height.
 
         r = Rect(10, 10, 30, 30)
 
         # 
         # Grow or shrink the rectangle size.
         # 
-        # Rect.inflate (x, y) -> Rect  Grow or shrink the rectangle size.
         # Returns a new rectangle with the size changed by the given offset.
         # The rectangle remains centered around its current center. Negative
         # values will shrink the rectangle.
         # 
         # Moves the rectangle.
         # 
-        # Rect.move (x, y) -> Rect  Moves the rectangle.  Returns a new
-        # rectangle that is moved by the given offset. The x and y arguments
-        # can be any integer value, positive or negative.
+        # Returns a new rectangle that is moved by the given offset. The
+        # x and y arguments can be any integer value, positive or
+        # negative.
         r = Rect( 1, 2, 3, 4 )
         move_x = 10
         move_y = 20
         # 
         # Joins two rectangles into one.
         # 
-        # Rect.union (Rect) -> Rect  Joins two rectangles into one.  Returns a
-        # new rectangle that completely covers the area of the two provided
-        # rectangles. There may be area inside the new Rect that is not
-        # covered by the originals.
+        # Returns a new rectangle that completely covers the area of the
+        # two provided rectangles. There may be area inside the new Rect
+        # that is not covered by the originals.
         r1 = Rect( 1, 1, 1, 2 )
         r2 = Rect( -2, -2, 1, 2 )
         self.assertEqual( Rect( -2, -2, 4, 5 ), r1.union(r2) )

test/base_surface_test.py

         # 
         # Performs a blit operation on the Surface.
         # 
-        # blit (**kwds) -> object  Performs a blit operation on the Surface.
         # The behaviour, arguments and return value depend on the concrete
         # Surface implementation.
 

test/mask_test.py

         # 
         # Returns a Mask of a connected region of pixels.
         # 
-        # Mask.connected_component (x=None, y=None) -> Mask  Returns a Mask of
-        # a connected region of pixels.  This uses the SAUF algorithm to find
-        # a connected component in the Mask. It checks 8 point connectivity.
-        # By default, it will return the largest connected component in the
-        # image. Optionally, a coordinate pair of a pixel can be specified,
-        # and the connected component containing it will be returned. In the
-        # event the pixel at that location is not set, the returned Mask will
-        # be empty. The Mask returned is the same size as the original Mask.
+        # This uses the SAUF algorithm to find a connected component in
+        # the Mask. It checks 8 point connectivity.  By default, it will
+        # return the largest connected component in the
+        # image. Optionally, a coordinate pair of a pixel can be
+        # specified, and the connected component containing it will be
+        # returned. In the event the pixel at that location is not set,
+        # the returned Mask will be empty. The Mask returned is the same
+        # size as the original Mask.
 
         self.fail() 
 
         # 
         # Returns a Mask of a connected region of pixels.
         # 
-        # Mask.connected_component (x=None, y=None) -> Mask  Returns a Mask of
-        # a connected region of pixels.  This uses the SAUF algorithm to find
-        # a connected component in the Mask. It checks 8 point connectivity.
-        # By default, it will return the largest connected component in the
-        # image. Optionally, a coordinate pair of a pixel can be specified,
-        # and the connected component containing it will be returned. In the
-        # event the pixel at that location is not set, the returned Mask will
-        # be empty. The Mask returned is the same size as the original Mask.
+        # This uses the SAUF algorithm to find a connected component in
+        # the Mask. It checks 8 point connectivity.  By default, it will
+        # return the largest connected component in the
+        # image. Optionally, a coordinate pair of a pixel can be
+        # specified, and the connected component containing it will be
+        # returned. In the event the pixel at that location is not set,
+        # the returned Mask will be empty. The Mask returned is the same
+        # size as the original Mask.
         m = Mask(10,10)
         self.assertEquals(repr(m.connected_components()), "[]")
         
 
         # Mask.convolve (mask[, outputmask, point]) -> Mask
         #
-        # Return the convolution with another Mask.Returns a Mask with
-        # the [x-offset[0], y-offset[1]] bitset if shifting *mask* so
-        # that it's lower right corner pixel isat (x, y) would cause it
-        # to overlap with self.If an *outputmask* is specified, the
-        # output is drawn onto*outputmask* and *outputmask* is
-        # returned. Otherwise a mask ofsize size + *mask*.size - (1, 1)
-        # is created.
+        # Return the convolution with another Mask.
+        #
+        # Returns a Mask with the [x-offset[0], y-offset[1]] bitset if
+        # shifting *mask* so that it's lower right corner pixel isat (x,
+        # y) would cause it to overlap with self.If an *outputmask* is
+        # specified, the output is drawn onto *outputmask* and
+        # *outputmask* is returned. Otherwise a mask ofsize size +
+        # *mask*.size - (1, 1) is created.
         m1 = random_mask((100,100))
         m2 = random_mask((100,100))
         conv = m1.convolve(m2)
         # 
         # Draws the passed Mask onto the Mask.
         # 
-        # Mask.draw (mask, x, y) -> None  Draws the passed Mask onto the Mask.
         # This performs a bitwise OR operation upon the calling Mask. The
         # passed mask's start offset for the draw operation will be the x and
         # y offset passed to the method.
         # 
         # Erases the passed Mask from the Mask.
         # 
-        # Mask.erase (mask, x, y) -> None  Erases the passed Mask from the
-        # Mask.  This performs a bitwise NAND operation upon the calling Mask.
-        # The passed mask's start offfset for the erase operation will be the
-        # x and y offset passed to the method.
+        # This performs a bitwise NAND operation upon the calling Mask.
+        # The passed mask's start offfset for the erase operation will
+        # be the x and y offset passed to the method.
 
         self.fail() 
 
         # 
         # Returns a list of bounding rects of regions of set pixels.
         # 
-        # Mask.get_bounding_rects () -> [Mask, Mask ...]  Returns a list of
-        # bounding rects of regions of set pixels.  This gets a bounding rect
-        # of connected regions of set bits. A bounding rect is one for which
-        # each of the connected pixels is inside the rect.
+        # This gets a bounding rect of connected regions of set bits. A
+        # bounding rect is one for which each of the connected pixels is
+        # inside the rect.
         m = Mask (10, 10)
         m.set_at(0, 0, 1)
         m.set_at(1, 0, 1)
         # 
         # Returns nonzero if the masks overlap with the given offset.
         # 
-        # Mask.overlap (mask, x, y) -> int, int  Returns nonzero if the masks
-        # overlap with the given offset.  The overlap tests uses the following
-        # offsets (which may be negative):  +----+----------.. |A   | yoffset
-        # |  +-+----------.. +--|B |xoffset |  | :  :
-        # 
-        # Mask.overlap (mask, x, y) -> int, int  Returns nonzero if the masks
-        # overlap with the given offset.  The overlap tests uses the following
-        # offsets (which may be negative):  +----+----------.. |A   | yoffset
-        # |  +-+----------.. +--|B |xoffset |  | :  :
-
+        # The overlap tests uses the following offsets (which may be
+        # negative):
+        # +----+----------...
+        # |A   | yoffset
+        # |  +-+----------...
+        # +--|B
+        # |xoffset
+        # |  |
+        # |  |
+        # :  :
         self.fail() 
 
     def todo_test_pygame2_mask_Mask_overlap_area(self):
         # 
         # Returns the number of overlapping bits of two Masks.
         # 
-        # Mask.overlap_area (mask, x, y) -> int  Returns the number of
-        # overlapping bits of two Masks.  This returns how many pixels overlap
-        # with the other mask given. It can be used to see in which direction
-        # things collide, or to see how much the two masks collide.
+        # This returns how many pixels overlap with the other mask
+        # given. It can be used to see in which direction things
+        # collide, or to see how much the two masks collide.
 
         self.fail() 
 
         # 
         # Creates a new scaled Mask with the given width and height.
         # 
-        # Mask.scale (width, height) -> Mask  Creates a new scaled Mask with
-        # the given width and height.  The quality of the scaling may not be
-        # perfect for all circumstances, but it should be reasonable. If
-        # either w or h is 0 a clear 1x1 mask is returned.
+        # The quality of the scaling may not be perfect for all
+        # circumstances, but it should be reasonable. If either w or h
+        # is 0 a clear 1x1 mask is returned.
 
         self.fail() 
 
         # 
         # Creates a new, empty Mask with the desired dimensions.
         # 
-        # Mask (width, height) -> Mask  Creates a new, empty Mask with the
-        # desired dimensions.  The Mask is a 2D array using single bits to
-        # represent states within a x,y matrix. This makes it suitable for
-        # pixel-perfect overlap handling of image buffers.
+        # The Mask is a 2D array using single bits to represent states
+        # within a x,y matrix. This makes it suitable for pixel-perfect
+        # overlap handling of image buffers.
 
         self.fail() 
 
         # 
         # Returns a Mask from the given pygame2.sdl.video.Surface.
         # 
-        # pygame2.mask.from_surface (surface, threshold) -> Mask  Returns a
-        # Mask from the given pygame2.sdl.video.Surface.  Makes the
-        # transparent parts of the Surface not set, and the opaque parts set.
-        # The alpha of each pixel is checked to see if it is greater than the
-        # given threshold. If the Surface is color keyed, then threshold is
-        # not used.  This requires pygame2 to be built with SDL support
-        # enabled.
+        # Makes the transparent parts of the Surface not set, and the
+        # opaque parts set. The alpha of each pixel is checked to see
+        # if it is greater than the given threshold. If the Surface is
+        # color keyed, then threshold is not used.  This requires
+        # pygame2 to be built with SDL support enabled.
         # 
         # This requires pygame2 to be built with SDL support enabled.
         video.init ()
 
         # __doc__ (as of 2008-11-03) for pygame2.mask.from_threshold:
 
-        # TODO
+        # pygame2.mask.from_threshold (surface, color[, threshold, thressurface]) -> Mask
+        # 
+        # Creates a mask by thresholding surfaces.
+        # 
+        # This is a more featureful method of getting a Mask from a
+        # Surface.  If supplied with only one Surface, all pixels within the
+        # threshold of the supplied *color* are set in the Mask. If given
+        # the optional *thressurface*, all pixels in *surface* that are
+        # within the *threshold* of the corresponding pixel in
+        # *thressurface* are set in the Mask.
+
         video.init ()
         a = [16, 24, 32]
         

test/sdl_audio_test.py

         # 
         # Shuts down the audio subsystem of the SDL library.
         # 
-        # quit () -> None  Shuts down the audio subsystem of the SDL library.
         # After calling this function, you should not invoke any class, method
         # or function related to the audio subsystem as they are likely to
         # fail or might give unpredictable results.
 
         # was_init () -> bool
         # 
-        # was_init () -> bool  Returns, whether the audio subsystem of the SDL
-        # library is initialized.
+        # Returns whether the audio subsystem of the SDL library is
+        # initialized.
 
         audio.quit ()
         self.assertEquals (audio.was_init (), False)
         self.assertEquals (audio.was_init (), True)
         audio.quit ()
         self.assertEquals (audio.was_init (), False)
+
+if __name__ == "__main__":
+    unittest.main ()

test/sdl_base_test.py

 
         # __doc__ (as of 2009-04-01) for pygame2.sdl.base.get_compiled_version:
 
-        # Gets the SDL version pygame2 was compiled against as three-value
-        # tuple.  This version is built at compile time. It can be used to
-        # detect which features may not be available through Pygame, if it is
-        # used as precompiled package using a different version of the SDL
-        # library.
+        # get_compiled_version () -> tuple
         # 
         # Gets the SDL version pygame2 was compiled against as three-value
-        # tuple.  This version is built at compile time. It can be used to
-        # detect which features may not be available through Pygame, if it is
-        # used as precompiled package using a different version of the SDL
-        # library.
+        # tuple.
+        # 
+        # This version is built at compile time. It can be used to
+        # detect which features may not be available through Pygame, if
+        # it is used as precompiled package using a different version of
+        # the SDL library.
         self.assertEquals (len (base.get_compiled_version ()), 3)
         self.assertEquals (base.get_compiled_version ()[0], 1)
         self.assertEquals (base.get_compiled_version ()[1], 2)
 
         # __doc__ (as of 2009-04-01) for pygame2.sdl.base.get_error:
 
+        # get_error () -> pygame2.Error
+        # 
         # Gets the last :exc:pygame2.base.Error occured.
         # 
-        # Gets the last :exc:pygame2.base.Error occured.  SDL maintains an
-        # internal error message. This message will usually be given to you
-        # when a :exc:pygame2.base.Error is raised. You will rarely need to
-        # call this function.
+        # SDL maintains an internal error message. This message will
+        # usually be given to you when a :exc:pygame2.base.Error is
+        # raised. You will rarely need to call this function.
         self.assertEquals (len (base.get_error ()), 0)
 
     def test_pygame2_sdl_base_get_version(self):
 
         # __doc__ (as of 2009-04-01) for pygame2.sdl.base.get_version:
 
+        # get_version () -> tuple
+        # 
         # Gets the SDL version pygame2 currently uses as three-value tuple.
         # 
-        # Gets the SDL version pygame2 currently uses as three-value tuple.
         # This version is detected at runtime. It can be used to detect which
         # features may not be available through Pygame, if it is used as
         # precompiled package using a different version of the SDL library.
 
         # __doc__ (as of 2009-04-01) for pygame2.sdl.base.init:
 
+        # init (flags) -> bool
+        #
         # Initializes the underlying SDL library.
         # 
-        # Initializes the underlying SDL library.  Initializes the underlying
-        # SDL library using the passed SDL flags. The flags indicate, which
-        # subsystems of SDL should be initialized and can be a bitwise
-        # combination of the INIT_* constants.  In case an error occured,
-        # False will be returned. The detailled error can be received using
-        # pygame2.sdl.get_error().
-        # 
-        # Initializes the underlying SDL library.  Initializes the underlying
-        # SDL library using the passed SDL flags. The flags indicate, which
-        # subsystems of SDL should be initialized and can be a bitwise
-        # combination of the INIT_* constants.  In case an error occured,
-        # False will be returned. The detailled error can be received using
+        # Initializes the underlying SDL library using the passed SDL
+        # flags. The flags indicate, which subsystems of SDL should be
+        # initialized and can be a bitwise combination of the INIT_*
+        # constants.  In case an error occured, False will be
+        # returned. The detailled error can be received using
         # pygame2.sdl.get_error().
         self.assertEquals (base.init (constants.INIT_CDROM), True)
         self.assertEquals (base.init
 
         # __doc__ (as of 2009-04-01) for pygame2.sdl.base.init_subsystem:
 
+        # init_subsystem (flags) -> bool
+        #
         # Initializes one or more SDL subsystems.
         # 
-        # Initializes one or more SDL subsystems.  In case a specific part of
-        # SDL was not initialized using pygame2.sdl.init(), this funciton can
-        # be used to initialize it at a later time.  In case an error occured,
-        # False will be returned. The detailled error can be received using
-        # pygame2.sdl.get_error().
-        # 
-        # Initializes one or more SDL subsystems.  In case a specific part of
-        # SDL was not initialized using pygame2.sdl.init(), this funciton can
-        # be used to initialize it at a later time.  In case an error occured,
-        # False will be returned. The detailled error can be received using
+        # In case a specific part of SDL was not initialized using
+        # pygame2.sdl.init(), this funciton can be used to initialize it
+        # at a later time.  In case an error occured, False will be
+        # returned. The detailled error can be received using
         # pygame2.sdl.get_error().
         self.assertEquals (base.init_subsystem (constants.INIT_CDROM), True)
         self.assertEquals (base.init_subsystem
 
         # __doc__ (as of 2009-04-01) for pygame2.sdl.base.quit:
 
+        # quit () -> None
+        #
         # Shuts down all subsystems of the underlying SDL library.
         # 
-        # Shuts down all subsystems of the underlying SDL library.  After
-        # calling this function, you should not invoke any SDL related class,
-        # method or function as they are likely to fail or might give
-        # unpredictable results.
+        # After calling this function, you should not invoke any SDL
+        # related class, method or function as they are likely to fail
+        # or might give unpredictable results.
         self.assert_ (base.quit () == None)
 
     def test_pygame2_sdl_base_quit_subsystem(self):
 
         # __doc__ (as of 2009-04-01) for pygame2.sdl.base.quit_subsystem:
 
+        # quit_subsystem (flags) -> None
+        #
         # Shuts down one or more subsystems of the underlying SDL library.
         # 
-        # Shuts down one or more subsystems of the underlying SDL library.
         # After calling this function, you should not invoke any class, method
         # or function related to the specified subsystems as they are likely
         # to fail or might give unpredictable results.
 
         # __doc__ (as of 2009-04-01) for pygame2.sdl.base.was_init:
 
+        # was_init (flags) -> int
+        #
         # Gets a bitwise OR'ed combination of the initialized SDL subsystems.
         # 
-        # Gets a bitwise OR'ed combination of the initialized SDL subsystems.
         # Returns a bitwise combination of the currently initialized SDL
         # subsystems.
         base.init (constants.INIT_JOYSTICK)
         v = base.was_init (constants.INIT_JOYSTICK) & constants.INIT_JOYSTICK
         self.assert_ (v == constants.INIT_JOYSTICK)
+
+if __name__ == "__main__":
+    unittest.main ()

test/sdl_keyboard_test.py

-try:
-    import pygame2.test.pgunittest as unittest
-except:
-    import pgunittest as unittest
-
-import pygame2
-import pygame2.sdl.keyboard as keyboard
-import pygame2.sdl.constants as constants
-
-class SDLKeyboardTest (unittest.TestCase):
-    def test_pygame2_sdl_keyboard_enable_repeat(self):
-
-        # __doc__ (as of 2009-05-13) for pygame2.sdl.keyboard.enable_repeat:
-
-        # enable_repeat (delay, interval) -> None
-        # 
-        # Enables or disables the keyboard repeat rate.
-        # 
-        # enable_repeat (delay, interval) -> None  Enables or disables the
-        # keyboard repeat rate.  Enables or disables the keyboard repeat rate.
-        # delay specifies how long a key must be pressed before the repeat
-        # begins. interval is the speed with which it repeats. delay and
-        # interval are expressed as milliseconds. Thus, after the initial
-        # delay has passed, repeated KEYDOWN events are sent through the event
-        # queue, using the specified interval.  Setting delay to 0 will
-        # disable repeating completely.
-        # 
-        # Setting delay to 0 will disable repeating completely.
-        self.assert_ (keyboard.enable_repeat (0, 0) == None)
-        self.assert_ (keyboard.enable_repeat (1, 1) == None)
-        self.assert_ (keyboard.enable_repeat (900, 1000) == None)
-        self.assertRaises (ValueError, keyboard.enable_repeat, -1, -1)
-        self.assertRaises (ValueError, keyboard.enable_repeat,  1, -1)
-        self.assertRaises (ValueError, keyboard.enable_repeat, -1,  1)
-
-    def test_pygame2_sdl_keyboard_enable_unicode(self):
-
-        # __doc__ (as of 2009-05-13) for pygame2.sdl.keyboard.enable_unicode:
-
-        # enable_unicode ([enable]) -> bool
-        # 
-        # Enables or disables unicode input handling.
-        # 
-        # enable_unicode ([enable]) -> bool  Enables or disables unicode input
-        # handling.  Enables or disables unicode input handling. If the
-        # argument is omitted, the function will return the current unicode
-        # handling state.  By default unicode handling is enabled and for
-        # keyboard events, the *unicode* member of the event will be filled
-        # with the corresponding unicode character.
-        self.assert_ (keyboard.enable_unicode () == True)
-        self.assert_ (keyboard.enable_unicode (True) == True)
-        self.assert_ (keyboard.enable_unicode (False) == True)
-        self.assert_ (keyboard.enable_unicode (True) == False)
-        self.assert_ (keyboard.enable_unicode (True) == True)
-        self.assert_ (keyboard.enable_unicode () == True)
-        self.assert_ (keyboard.enable_unicode (False) == True)
-        self.assert_ (keyboard.enable_unicode (False) == False)
-        self.assert_ (keyboard.enable_unicode () == False)
-        
-    def test_pygame2_sdl_keyboard_get_key_name(self):
-
-        # __doc__ (as of 2009-05-13) for pygame2.sdl.keyboard.get_key_name:
-
-        # get_key_name (key) -> str
-        # 
-        # Get the descriptive name for a key constant.
-        self.assert_ (keyboard.get_key_name (constants.K_a) == 'a')
-        self.assert_ (keyboard.get_key_name (constants.K_b) == 'b')
-        self.assert_ (keyboard.get_key_name (constants.K_q) == 'q')
-        self.assert_ (keyboard.get_key_name (constants.K_LEFT) == 'left')
-        self.assert_ (keyboard.get_key_name (constants.K_PAGEUP) == 'page up')
-        self.assert_ (keyboard.get_key_name (constants.K_KP4) == '[4]')
-        self.assert_ (keyboard.get_key_name (constants.K_4) == '4')
-
-    def todo_test_pygame2_sdl_keyboard_get_mod_state(self):
-
-        # __doc__ (as of 2009-05-13) for pygame2.sdl.keyboard.get_mod_state:
-
-        # get_mod_state () -> state
-        # 
-        # Returns the current state of the modifier keys (CTRL, ALT, etc.).
-        # 
-        # get_mod_state () -> state  Returns the current state of the modifier
-        # keys (CTRL, ALT, etc.).  Returns a single integer representing a
-        # bitmask of all the modifier keys being held. Using bitwise operators
-        # you can test if specific shift keys are pressed, the state of the
-        # capslock button, and more.  The bitmask will consist of the various
-        # KMOD_* flags as specified in the constants.
-
-        self.fail() 
-
-    def test_pygame2_sdl_keyboard_get_repeat(self):
-
-        # __doc__ (as of 2009-05-13) for pygame2.sdl.keyboard.get_repeat:
-
-        # get_repeat () -> delay, interval
-        # 
-        # Gets the currently set keyboard repeat delay and interval.
-        keyboard.enable_repeat (0, 0)
-        self.assert_ (keyboard.get_repeat () == (0, 0))
-        keyboard.enable_repeat (10, 10)
-        self.assert_ (keyboard.get_repeat () == (10, 10))
-        keyboard.enable_repeat (5, 2)
-        self.assert_ (keyboard.get_repeat () == (5, 2))
-        keyboard.enable_repeat (0, 5)
-        self.assert_ (keyboard.get_repeat () == (0, 5))
-        keyboard.enable_repeat (7, 0)
-        self.assert_ (keyboard.get_repeat () == (7, 0))
-
-    def test_pygame2_sdl_keyboard_get_state(self):
-
-        # __doc__ (as of 2009-05-13) for pygame2.sdl.keyboard.get_state:
-
-        # get_state () -> dict
-        # 
-        # Gets the current keyboard state.
-        # 
-        # get_state () -> dict  Gets the current keyboard state.  Gets a
-        # dictionary with the current keyboard state. The keys of the
-        # dictionary are the key constants, the boolean values of the
-        # dictionary indicate, whether a certain key is pressed or not.
-        self.assert_ (type (keyboard.get_state ()) == dict)
-        self.assert_ (constants.K_a in keyboard.get_state ().keys ())
-        self.assert_ (constants.K_b in keyboard.get_state ().keys ())
-        self.assert_ (constants.K_q in keyboard.get_state ().keys ())
-        self.assert_ (constants.K_KP4 in keyboard.get_state ().keys ())
-
-    def todo_test_pygame2_sdl_keyboard_set_mod_state(self):
-
-        # __doc__ (as of 2009-05-13) for pygame2.sdl.keyboard.set_mod_state:
-
-        # set_mod_state (mod) -> None
-        # 
-        # Sets the current modifier key state.
-        # 
-        # set_mod_state (mod) -> None  Sets the current modifier key state.
-        # Sets the current modifier key state. mod has to be a bitwise OR'd
-        # combination of the KMOD_* flags as they are specified in the
-        # constants.
-
-        self.fail() 
+try:
+    import pygame2.test.pgunittest as unittest
+except:
+    import pgunittest as unittest
+
+import pygame2
+import pygame2.sdl.keyboard as keyboard
+import pygame2.sdl.constants as constants
+
+class SDLKeyboardTest (unittest.TestCase):
+    def test_pygame2_sdl_keyboard_enable_repeat(self):
+
+        # __doc__ (as of 2009-05-13) for pygame2.sdl.keyboard.enable_repeat:
+
+        # enable_repeat (delay, interval) -> None
+        # 
+        # Enables or disables the keyboard repeat rate.
+        # 
+        # delay specifies how long a key must be pressed before the
+        # repeat begins. interval is the speed with which it
+        # repeats. delay and interval are expressed as
+        # milliseconds. Thus, after the initial delay has passed,
+        # repeated KEYDOWN events are sent through the event queue,
+        # using the specified interval.  Setting delay to 0 will disable
+        # repeating completely.
+        # 
+        # Setting delay to 0 will disable repeating completely.
+        self.assert_ (keyboard.enable_repeat (0, 0) == None)
+        self.assert_ (keyboard.enable_repeat (1, 1) == None)
+        self.assert_ (keyboard.enable_repeat (900, 1000) == None)
+        self.assertRaises (ValueError, keyboard.enable_repeat, -1, -1)
+        self.assertRaises (ValueError, keyboard.enable_repeat,  1, -1)
+        self.assertRaises (ValueError, keyboard.enable_repeat, -1,  1)
+
+    def test_pygame2_sdl_keyboard_enable_unicode(self):
+
+        # __doc__ (as of 2009-05-13) for pygame2.sdl.keyboard.enable_unicode:
+
+        # enable_unicode ([enable]) -> bool
+        # 
+        # Enables or disables unicode input handling.
+        # 
+        # Enables or disables unicode input handling. If the argument is
+        # omitted, the function will return the current unicode handling
+        # state.  By default unicode handling is enabled and for
+        # keyboard events, the *unicode* member of the event will be
+        # filled with the corresponding unicode character.
+        self.assert_ (keyboard.enable_unicode () == True)
+        self.assert_ (keyboard.enable_unicode (True) == True)
+        self.assert_ (keyboard.enable_unicode (False) == True)
+        self.assert_ (keyboard.enable_unicode (True) == False)
+        self.assert_ (keyboard.enable_unicode (True) == True)
+        self.assert_ (keyboard.enable_unicode () == True)
+        self.assert_ (keyboard.enable_unicode (False) == True)
+        self.assert_ (keyboard.enable_unicode (False) == False)
+        self.assert_ (keyboard.enable_unicode () == False)
+        
+    def test_pygame2_sdl_keyboard_get_key_name(self):
+
+        # __doc__ (as of 2009-05-13) for pygame2.sdl.keyboard.get_key_name:
+
+        # get_key_name (key) -> str
+        # 
+        # Get the descriptive name for a key constant.
+        self.assert_ (keyboard.get_key_name (constants.K_a) == 'a')
+        self.assert_ (keyboard.get_key_name (constants.K_b) == 'b')
+        self.assert_ (keyboard.get_key_name (constants.K_q) == 'q')
+        self.assert_ (keyboard.get_key_name (constants.K_LEFT) == 'left')
+        self.assert_ (keyboard.get_key_name (constants.K_PAGEUP) == 'page up')
+        self.assert_ (keyboard.get_key_name (constants.K_KP4) == '[4]')
+        self.assert_ (keyboard.get_key_name (constants.K_4) == '4')
+
+    def todo_test_pygame2_sdl_keyboard_get_mod_state(self):
+
+        # __doc__ (as of 2009-05-13) for pygame2.sdl.keyboard.get_mod_state:
+
+        # get_mod_state () -> state
+        # 
+        # Returns the current state of the modifier keys (CTRL, ALT, etc.).
+        # 
+        # Returns a single integer representing a bitmask of all the
+        # modifier keys being held. Using bitwise operators you can test
+        # if specific shift keys are pressed, the state of the capslock
+        # button, and more.  The bitmask will consist of the various
+        # KMOD_* flags as specified in the constants.
+
+        self.fail() 
+
+    def test_pygame2_sdl_keyboard_get_repeat(self):
+
+        # __doc__ (as of 2009-05-13) for pygame2.sdl.keyboard.get_repeat:
+
+        # get_repeat () -> delay, interval
+        # 
+        # Gets the currently set keyboard repeat delay and interval.
+        keyboard.enable_repeat (0, 0)
+        self.assert_ (keyboard.get_repeat () == (0, 0))
+        keyboard.enable_repeat (10, 10)
+        self.assert_ (keyboard.get_repeat () == (10, 10))
+        keyboard.enable_repeat (5, 2)
+        self.assert_ (keyboard.get_repeat () == (5, 2))
+        keyboard.enable_repeat (0, 5)
+        self.assert_ (keyboard.get_repeat () == (0, 5))
+        keyboard.enable_repeat (7, 0)
+        self.assert_ (keyboard.get_repeat () == (7, 0))
+
+    def test_pygame2_sdl_keyboard_get_state(self):
+
+        # __doc__ (as of 2009-05-13) for pygame2.sdl.keyboard.get_state:
+
+        # get_state () -> dict
+        # 
+        # Gets the current keyboard state.
+        # 
+        # Gets a dictionary with the current keyboard state. The keys of
+        # the dictionary are the key constants, the boolean values of
+        # the dictionary indicate, whether a certain key is pressed or
+        # not.
+        self.assert_ (type (keyboard.get_state ()) == dict)
+        self.assert_ (constants.K_a in keyboard.get_state ().keys ())
+        self.assert_ (constants.K_b in keyboard.get_state ().keys ())
+        self.assert_ (constants.K_q in keyboard.get_state ().keys ())
+        self.assert_ (constants.K_KP4 in keyboard.get_state ().keys ())
+
+    def todo_test_pygame2_sdl_keyboard_set_mod_state(self):
+
+        # __doc__ (as of 2009-05-13) for pygame2.sdl.keyboard.set_mod_state:
+
+        # set_mod_state (mod) -> None
+        # 
+        # Sets the current modifier key state.
+        # 
+        # Sets the current modifier key state. mod has to be a bitwise OR'd
+        # combination of the KMOD_* flags as they are specified in the
+        # constants.
+
+        self.fail() 
+
+if __name__ == "__main__":
+    unittest.main ()

test/util/gen_stubs.py

 )
 
 def py_comment (input_str):
-    lines = []
-    for line in input_str.split ('\n\n'):
-        if len (line) > 68:
-            lines += textwrap.wrap (input_str, 68)
-        else:
-            lines += [line]
-        lines += ['']
-    return '\n'.join ([('# ' + l) for l in lines]).rstrip ('\n# ')
+    #lines = []
+    #for line in input_str.split ('\n\n'):
+    #    if len (line) > 68:
+    #        lines += textwrap.wrap (input_str, 68)
+    #    else:
+    #        lines += [line]
+    #    lines += ['']
+    #return '\n'.join ([('# ' + l) for l in lines]).rstrip ('\n# ')
+    return '\n'.join ([('# ' + l) for l in input_str.split ('\n')]).rstrip \
+           ('\n# ')
 
 def do_import (name):
     components = name.split ('.')