Changeset 284 for trunk/game/tests


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
Location:
trunk/game/tests
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/tests/test_console.py

    r281 r284  
     1#!/usr/bin/python 
     2 
     3#   This file is part of PARPG. 
     4 
     5#   PARPG is free software: you can redistribute it and/or modify 
     6#   it under the terms of the GNU General Public License as published by 
     7#   the Free Software Foundation, either version 3 of the License, or 
     8#   (at your option) any later version. 
     9 
     10#   PARPG is distributed in the hope that it will be useful, 
     11#   but WITHOUT ANY WARRANTY; without even the implied warranty of 
     12#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13#   GNU General Public License for more details. 
     14 
     15#   You should have received a copy of the GNU General Public License 
     16#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>. 
     17 
     18 
    119import unittest 
    220from scripts.console import Console 
  • trunk/game/tests/test_crate.py

    r279 r284  
    11#!/usr/bin/python 
     2 
     3#   This file is part of PARPG. 
     4 
     5#   PARPG is free software: you can redistribute it and/or modify 
     6#   it under the terms of the GNU General Public License as published by 
     7#   the Free Software Foundation, either version 3 of the License, or 
     8#   (at your option) any later version. 
     9 
     10#   PARPG is distributed in the hope that it will be useful, 
     11#   but WITHOUT ANY WARRANTY; without even the implied warranty of 
     12#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13#   GNU General Public License for more details. 
     14 
     15#   You should have received a copy of the GNU General Public License 
     16#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>. 
    217 
    318import unittest 
    419from scripts.objects.containers import WoodenCrate 
    520 
    6 class WoodenCrateTest(unittest.TestCase): 
     21class TestWoodenCrate(unittest.TestCase): 
    722    def setUp(self): 
    823        self.crate = WoodenCrate(ID='crate01') 
     
    1025 
    1126    def testCreation(self): 
     27        """ Test the WoodenCrate creation""" 
    1228        self.assertEqual(self.crate.ID, 'crate01') 
    1329        self.assertEqual(self.crate.name, 'Wooden Crate') 
     
    2743 
    2844    def testLockable(self): 
     45        """ Test the WoodenCrate lockability""" 
    2946        self.crate2.lock() 
    3047        self.assertEqual(self.crate2.locked, True) 
  • trunk/game/tests/test_game_object.py

    r279 r284  
    1 # To change this template, choose Tools | Templates 
    2 # and open the template in the editor. 
     1#!/usr/bin/python 
     2 
     3#   This file is part of PARPG. 
     4 
     5#   PARPG is free software: you can redistribute it and/or modify 
     6#   it under the terms of the GNU General Public License as published by 
     7#   the Free Software Foundation, either version 3 of the License, or 
     8#   (at your option) any later version. 
     9 
     10#   PARPG is distributed in the hope that it will be useful, 
     11#   but WITHOUT ANY WARRANTY; without even the implied warranty of 
     12#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13#   GNU General Public License for more details. 
     14 
     15#   You should have received a copy of the GNU General Public License 
     16#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>. 
    317 
    418import unittest 
    519from scripts.objects.base import GameObject 
    620 
    7 class GameObjectTest(unittest.TestCase): 
     21class TestGameObject(unittest.TestCase): 
    822    def setUp(self): 
    923        self.game_object=GameObject (1, {'map':'img/test.png'}, 
     
    1529 
    1630    def testCoords(self): 
     31        """ Test GameObject coordinates manipulation""" 
     32 
    1733        self.assertEqual(self.game_object.coords, (1, 1)) 
    1834        self.assertEqual(self.game_object.X, 1) 
     
    2339 
    2440    def testTrueAttr(self): 
     41        """ Test GameObject trueAttr functionality""" 
     42         
    2543        self.game_object.is_test=True 
    2644        self.game_object.is_test2=False 
     
    3048 
    3149    def testRepr(self): 
     50        """ Test GameObject textual representation""" 
     51 
    3252        self.assertEqual(repr(self.game_object), "<Test object:1>") 
    3353 
  • trunk/game/tests/test_objects_base.py

    r279 r284  
    1 #!python 
     1#!/usr/bin/python 
     2 
     3#   This file is part of PARPG. 
     4 
     5#   PARPG is free software: you can redistribute it and/or modify 
     6#   it under the terms of the GNU General Public License as published by 
     7#   the Free Software Foundation, either version 3 of the License, or 
     8#   (at your option) any later version. 
     9 
     10#   PARPG is distributed in the hope that it will be useful, 
     11#   but WITHOUT ANY WARRANTY; without even the implied warranty of 
     12#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13#   GNU General Public License for more details. 
     14 
     15#   You should have received a copy of the GNU General Public License 
     16#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>. 
    217 
    318import unittest 
Note: See TracChangeset for help on using the changeset viewer.