- Timestamp:
- 09/07/09 20:59:20 (10 years ago)
- Location:
- trunk/game
- Files:
-
- 2 added
- 2 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/game/run_tests.py
r262 r276 10 10 sys.path.append(_jp(p)) 11 11 12 from scripts.tests.classTests import WoodenCrateTest 12 from tests.test_objects_base import * 13 from tests.test_crate import * 13 14 14 15 if __name__ == '__main__': -
trunk/game/scripts/objects/base.py
r262 r276 255 255 def __init__ (self, **kwargs): 256 256 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 test281 assert test.X == 1282 assert test.Y == 1283 assert test.coords == (1,1)284 test.coords = (2,2)285 assert test.X == 2.0286 assert test.Y == 2.0287 288 wc = Wildcard (2)289 print wc290 print wc.is_carryable291 -
trunk/game/tests/test_crate.py
r275 r276 1 #!/usr/bin/python 2 1 3 import unittest 2 4 from scripts.objects.containers import WoodenCrate … … 10 12 self.assertEqual(self.crate.ID, 'crate01') 11 13 self.assertEqual(self.crate.name, 'Wooden Crate') 12 self.assertEqual(self.crate.text, 'A battered down crate') 13 self.assertEqual(self.crate.gfx, \ 14 {'map': 'objects/objects/crate/image.png'}) 14 self.assertEqual(self.crate.text, 'A battered crate') 15 self.assertEqual(self.crate.gfx, 'crate') 15 16 self.assertEqual(self.crate.coords, (0.0, 0.0)) 16 17 self.assertEqual(self.crate.map_id, None) … … 24 25 25 26 # can't test containing functionality...there are no containable objects 26 27 27 28 def test_lockable(self): 28 29 self.crate2.lock() … … 30 31 self.crate2.unlock() 31 32 self.assertEqual(self.crate2.locked, False) 32 33 if __name__=='__main__':34 unittest.main()
Note: See TracChangeset
for help on using the changeset viewer.