Ignore:
Timestamp:
09/07/09 20:59:20 (10 years ago)
Author:
orlandov
Message:

Ticket #67: Refactor unit tests into runnable shape

  • Move tests to their own top level directory
  • Fix unit test failures
  • Add base/composed classes to test suite
  • Run like "nosetests ./run_python.py" OR "./run_python.py"
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/scripts/objects/base.py

    r262 r276  
    255255    def __init__ (self, **kwargs): 
    256256        self.is_trappable = True 
    257          
    258 if __name__=="__main__": 
    259     """This will be turned into a test suite""" 
    260     class Wildcard (GameObject, Lockable, Container, Living, Scriptable,  
    261                     CharStats, Wearable, Usable, Weapon, Destructable, 
    262                     Trappable, Carryable, ): 
    263         def __init__ (self, ID, *args, **kwargs): 
    264             self.name = 'All-purpose carry-all' 
    265             self.text = 'What is this? I dont know'     
    266             GameObject.  __init__( self, ID, **kwargs ) 
    267             Lockable.    __init__( self, **kwargs ) 
    268             Container.   __init__( self, **kwargs ) 
    269             Living.      __init__( self, **kwargs ) 
    270             Scriptable.  __init__( self, **kwargs ) 
    271             CharStats.   __init__( self, **kwargs ) 
    272             Wearable.    __init__( self, **kwargs ) 
    273             Usable.      __init__( self, **kwargs ) 
    274             Weapon.      __init__( self, **kwargs ) 
    275             Destructable.__init__( self, **kwargs ) 
    276             Trappable.   __init__( self, **kwargs ) 
    277             Carryable.   __init__( self, **kwargs ) 
    278      
    279     test = GameObject (1, {'map':'img/test.png'}, (1,1), None, 'Test object','Description') 
    280     print test 
    281     assert test.X == 1 
    282     assert test.Y == 1 
    283     assert test.coords == (1,1) 
    284     test.coords = (2,2) 
    285     assert test.X == 2.0 
    286     assert test.Y == 2.0 
    287      
    288     wc = Wildcard (2) 
    289     print wc 
    290     print wc.is_carryable 
    291  
Note: See TracChangeset for help on using the changeset viewer.