Ignore:
Timestamp:
09/16/09 07:15:53 (10 years ago)
Author:
b0rland_parpg
Message:

Ticket #67: patch by b0rland

  • Added GPL headers to test scripts
  • Added descriptions to test methods
  • Added the try/except guard to Openable class where it accesses GameObject?'s method (being overcautious)
  • Added tests for Openable class
  • Renamed some more test classes to match the naming convention
File:
1 edited

Legend:

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

    r276 r284  
    123123        """Opens the object, and runs an 'onOpen' script, if present""" 
    124124        self.is_open = True 
    125         if self.trueAttr ('scriptable'): 
    126             self.runScript('onOpen') 
     125        try: 
     126            if self.trueAttr ('scriptable'): 
     127                self.runScript('onOpen') 
     128        except AttributeError : 
     129            pass 
    127130             
    128131    def close(self): 
    129132        """Opens the object, and runs an 'onClose' script, if present""" 
    130133        self.is_open = False 
    131         if self.trueAttr ('scriptable'): 
    132             self.runScript('onClose')              
    133          
     134        try: 
     135            if self.trueAttr ('scriptable'): 
     136                self.runScript('onClose') 
     137        except AttributeError : 
     138            pass 
    134139class Lockable (Openable): 
    135140    """Allows objects to be locked""" 
Note: See TracChangeset for help on using the changeset viewer.