Commits

akalias  committed 6993696

Removed a few duplicate tests and added them to the gen_stubs.py blacklist. Compiled a list of Types that need instantiating before inspection.

  • Participants
  • Parent commits bc8fa65

Comments (0)

Files changed (18)

File test/base_test.py

     quit_called = quit_called + 1
 
 
-
 class BaseModuleTest(unittest.TestCase):
     def testAutoInit(self):
         pygame.init()

File test/bufferproxy_test.py

 
 ################################################################################
 
-class Test(unittest.TestCase):
-    pass
-
+class BufferProxyTypeTest(unittest.TestCase):
     def test_write(self):
 
         # __doc__ (as of 2008-06-25) for pygame.bufferproxy.BufferProxy.write:

File test/cdrom_test.py

 
 ################################################################################
 
-class Test(unittest.TestCase):
-    pass
-
+class CdromModuleTest(unittest.TestCase):
     def test_CD(self):
 
         # __doc__ (as of 2008-06-25) for pygame.cdrom.CD:

File test/cursors_test.py

 
 ################################################################################
 
-class Test(unittest.TestCase):
-    pass
-
+class CursorsModuleTest(unittest.TestCase):
     def test_compile(self):
 
         # __doc__ (as of 2008-06-25) for pygame.cursors.compile:

File test/draw_test.py

 
 ################################################################################
 
-class Test(unittest.TestCase):
-    pass
-
+class DrawModuleTest(unittest.TestCase):
     def test_aaline(self):
 
         # __doc__ (as of 2008-06-25) for pygame.draw.aaline:

File test/event_test.py

 
 ################################################################################
 
-class Test(unittest.TestCase):
-    pass
-
+class EventTypeTest(unittest.TestCase):
     def test_Event(self):
-
+        
         # __doc__ (as of 2008-06-25) for pygame.event.Event:
-
+        
           # pygame.event.Event(type, dict): return Event
           # pygame.event.Event(type, **attributes): return Event
           # create a new event object
-
+        
         self.assert_(test_not_implemented()) 
 
+class EventModuleTest(unittest.TestCase):
     def test_clear(self):
 
         # __doc__ (as of 2008-06-25) for pygame.event.clear:

File test/fastevent_test.py

 
 ################################################################################
 
-class Test(unittest.TestCase):
-    pass
-
-    def test_Event(self):
-
-        # __doc__ (as of 2008-06-25) for pygame.fastevent.Event:
-
-          # pygame.event.Event(type, dict): return Event
-          # pygame.event.Event(type, **attributes): return Event
-          # create a new event object
-
-        self.assert_(test_not_implemented()) 
-
-    def test_event_name(self):
-
-        # __doc__ (as of 2008-06-25) for pygame.fastevent.event_name:
-
-          # pygame.event.event_name(type): return string
-          # get the string name from and event id
-
-        self.assert_(test_not_implemented()) 
-
+class FasteventModuleTest(unittest.TestCase):
     def test_get(self):
 
         # __doc__ (as of 2008-06-25) for pygame.fastevent.get:

File test/joystick_test.py

 
 ################################################################################
 
-class Test(unittest.TestCase):
-    pass
-
+class JoystickTypeTest(unittest.TestCase):
     def test_Joystick(self):
-
         # __doc__ (as of 2008-06-25) for pygame.joystick.Joystick:
-
+    
           # pygame.joystick.Joystick(id): return Joystick
           # create a new Joystick object
+    
+        self.assert_(test_not_implemented())
 
-        self.assert_(test_not_implemented()) 
-
+class JoytickModuleTest(unittest.TestCase):
     def test_get_count(self):
 
         # __doc__ (as of 2008-06-25) for pygame.joystick.get_count:

File test/mask_test.py

 #pygame.display.set_mode((10,10))
 
 class MaskTypeTest( unittest.TestCase ):
+    # get_at             
+    # get_size           
+    # overlap_area
+    # get_bounding_rects 
+    # overlap            
+    # set_at
     
     def test_Mask(self):
     
         self.assertRaises(IndexError, lambda : m.set_at((10,0), 1) )
         self.assertRaises(IndexError, lambda : m.set_at((0,10), 1) )
 
+    def test_get_bounding_rects(self):
+        """
+        """
+
+        m = pygame.Mask((10,10))
+        m.set_at((0,0), 1)
+        m.set_at((1,0), 1)
+
+        m.set_at((0,1), 1)
+
+        m.set_at((0,3), 1)
+        m.set_at((3,3), 1)
+
+        r = m.get_bounding_rects()
+
+        self.assertEquals(repr(r), "[<rect(0, 0, 2, 2)>, <rect(0, 3, 1, 1)>, <rect(3, 3, 1, 1)>]")
+
 class MaskModuleTest(unittest.TestCase):
     def test_from_surface(self):
         """  Does the mask.from_surface() work correctly?
 
         #TODO: test a color key surface.
 
-
-
-    def test_get_bounding_rects(self):
-        """
-        """
-
-        m = pygame.Mask((10,10))
-        m.set_at((0,0), 1)
-        m.set_at((1,0), 1)
-
-        m.set_at((0,1), 1)
-
-        m.set_at((0,3), 1)
-        m.set_at((3,3), 1)
-
-        r = m.get_bounding_rects()
-
-        self.assertEquals(repr(r), "[<rect(0, 0, 2, 2)>, <rect(0, 3, 1, 1)>, <rect(3, 3, 1, 1)>]")
-
 if __name__ == '__main__':
 
     if 1:

File test/mixer_test.py

 CHANNELS    = [1, 2]
 BUFFERS     = [3024]
 
-# "+16 (ie unsigned 16 bit samples) are not supported."
-
 ############################## MODULE LEVEL TESTS ##############################
 
 class MixerModuleTest(unittest.TestCase):
-    
     # def test_init__keyword_args(self):
     #     configs = ( {'frequency' : f, 'size' : s, 'channels': c }
     #                 for f in FREQUENCIES
 ############################## CHANNEL CLASS TESTS #############################
 
 class ChannelTypeTest(unittest.TestCase):
-    def test___init__(self):
+    def test_Channel(self):
       self.assert_(test_not_implemented())
 
 ############################### SOUND CLASS TESTS ##############################

File test/mouse_test.py

 
 ################################################################################
 
-class Test(unittest.TestCase):
-    pass
-
+class MouseModuleTest(unittest.TestCase):
     def test_get_cursor(self):
-
         # __doc__ (as of 2008-06-25) for pygame.mouse.get_cursor:
 
           # pygame.mouse.get_cursor(): return (size, hotspot, xormasks, andmasks)

File test/movie_test.py

 
 import pygame, pygame.movie
 
-class MovieTest( unittest.TestCase ):
-    
-    def test_load_movie( self ):
-        """ 
-        """
-        self.assert_(test_not_implemented()) 
-
-    def test_import(self):
-        'does it import'
-        import pygame.movie
-
-    def test_add_more_tests(self):
-        'we need to add more tests'
-        self.assert_(test_not_implemented()) 
-
+class MovieTypeTest( unittest.TestCase ):    
     def test_Movie(self):
-    
         # __doc__ (as of 2008-06-25) for pygame.movie.Movie:
     
           # pygame.movie.Movie(filename): return Movie

File test/overlay_test.py

 
 ################################################################################
 
-class Test(unittest.TestCase):
-    pass
-
+class OverlayTypeTest(unittest.TestCase):
     def test_display(self):
 
         # __doc__ (as of 2008-06-25) for pygame.overlay.overlay.display:

File test/sprite_test.py

 ################################# MODULE LEVEL #################################
 
 class SpriteModuleTest( unittest.TestCase ):       
-    def test_from_surface(self):
-    
-        # __doc__ (as of 2008-06-24) for pygame.sprite.from_surface:
-    
-          # pygame.mask.from_surface(Surface, threshold = 127) -> Mask
-          # Returns a Mask from the given surface.
-    
-        self.assert_(test_not_implemented())
-    
-    def test_get_ticks(self):
-    
-        # __doc__ (as of 2008-06-24) for pygame.sprite.get_ticks:
-    
-          # pygame.time.get_ticks(): return milliseconds
-          # get the time in milliseconds
-    
-        self.assert_(test_not_implemented())
+    pass
     
 ######################### SPRITECOLLIDE FUNCTIONS TEST #########################
 

File test/sysfont_test.py

 
 ################################################################################
 
-class Test(unittest.TestCase):
-    pass
-
-    def test_SysFont(self):
-
-        # __doc__ (as of 2008-06-25) for pygame.sysfont.SysFont:
-
-          # pygame.font.SysFont(name, size, bold=False, italic=False) -> Font
-          # create a pygame Font from system font resources
-          # 
-          # This will search the system fonts for the given font
-          # name. You can also enable bold or italic styles, and
-          # the appropriate system font will be selected if available.
-          # 
-          # This will always return a valid Font object, and will
-          # fallback on the builtin pygame font if the given font
-          # is not found.
-          # 
-          # Name can also be a comma separated list of names, in
-          # which case set of names will be searched in order. Pygame
-          # uses a small set of common font aliases, if the specific
-          # font you ask for is not available, a reasonable alternative
-          # may be used.
-
-        self.assert_(test_not_implemented()) 
-
+class SysfontModuleTest(unittest.TestCase):
     def test_create_aliases(self):
 
         # __doc__ (as of 2008-06-25) for pygame.sysfont.create_aliases:
 
         self.assert_(test_not_implemented()) 
 
-    def test_get_fonts(self):
-
-        # __doc__ (as of 2008-06-25) for pygame.sysfont.get_fonts:
-
-          # pygame.font.get_fonts() -> list
-          # get a list of system font names
-          # 
-          # Returns the list of all found system fonts. Note that
-          # the names of the fonts will be all lowercase with spaces
-          # removed. This is how pygame internally stores the font
-          # names for matching.
-
-        self.assert_(test_not_implemented()) 
-
     def test_initsysfonts(self):
 
         # __doc__ (as of 2008-06-25) for pygame.sysfont.initsysfonts:
 
           # 
 
-        self.assert_(test_not_implemented()) 
-
-    def test_match_font(self):
-
-        # __doc__ (as of 2008-06-25) for pygame.sysfont.match_font:
-
-          # pygame.font.match_font(name, bold=0, italic=0) -> name
-          # find the filename for the named system font
-          # 
-          # This performs the same font search as the SysFont()
-          # function, only it returns the path to the TTF file
-          # that would be loaded. The font name can be a comma
-          # separated list of font names to try.
-          # 
-          # If no match is found, None is returned.
-
-        self.assert_(test_not_implemented()) 
-
+        self.assert_(test_not_implemented())
 
 ################################################################################
 

File test/time_test.py

 
 ################################################################################
 
-class Test(unittest.TestCase):
-    pass
-
+class ClockTypeTest(unittest.TestCase):
     def test_Clock(self):
 
         # __doc__ (as of 2008-06-25) for pygame.time.Clock:
 
         self.assert_(test_not_implemented()) 
 
+class TimeModuleTest(unittest.TestCase):
+    def test_Clock(self):
+        # __doc__ (as of 2008-06-25) for pygame.time.Clock:
+
+          # pygame.time.Clock(): return Clock
+          # create an object to help track time
+
+        self.assert_(test_not_implemented()) 
+
     def test_delay(self):
 
         # __doc__ (as of 2008-06-25) for pygame.time.delay:
 
         self.assert_(test_not_implemented()) 
 
-
 ################################################################################
 
 if __name__ == '__main__':
     test_utils.get_fail_incomplete_tests_option()
-    unittest.main()
+    unittest.main()

File test/transform_test.py

     return similar
 
 
-
-
 class TransformModuleTest( unittest.TestCase ):
-    
     def test_scale__alpha( self ):
         """ see if set_alpha information is kept.
         """

File test/util/gen_stubs.py

 # pygame.sprite.Sprite.__module__ = 'pygame.sprite' 
 # pygame.sprite.Rect.__module__   = 'pygame'
 
-# Can not then filter out nonsensical classes automatically
+# In [7]: pygame.overlay.Overlay.__name__
+# Out[7]: 'overlay'
+
+# Can not then filter out nonsensical classes or functions automatically
 
 IGNORE = (
     'pygame.sprite.Rect',
     'pygame.mixer.Channel',
+    'pygame.sprite.from_surface',
+    'pygame.sprite.get_ticks',
+    'pygame.fastevent.Event',
+    'pygame.fastevent.event_name',
+    'pygame.sysfont.SysFont',
+    'pygame.sysfont.get_fonts',
+    'pygame.sysfont.match_font',
+)
+
+# Types that need instantiating before inspection
+INSTANTIATE = (
+    'pygame.event.Event',
+    'pygame.cdrom.CD',
+    'pygame.joystick.Joystick',
+    'pygame.time.Clock',
+    'pygame.mixer.Channel',
+    'pygame.movie.Movie',
+    'pygame.mask.Mask',
+    'pygame.display.Info',
 )
 
 ##################################### TODO #####################################