source: trunk/game/scripts/tests/classTests.py @ 262

Revision 262, 1.2 KB checked in by barra_parpg, 10 years ago (diff)

Patch by mvbarracuda:

  • Applied svn:eol-style >> native to all Python files
  • Resolved inconsistent line endings for gamestate.py, composed.py & base.py
  • Property svn:eol-style set to native
Line 
1import unittest
2from scripts.objects.containers import WoodenCrate
3
4class WoodenCrateTest(unittest.TestCase):
5    def setUp(self):
6        self.crate = WoodenCrate(ID='crate01')
7        self.crate2 = WoodenCrate(ID='crate02', locked=False)
8
9    def test_creation(self):
10        self.assertEqual(self.crate.ID, 'crate01')
11        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'})
15        self.assertEqual(self.crate.coords, (0.0, 0.0))
16        self.assertEqual(self.crate.map_id, None)
17        self.assertEqual(self.crate.blocking, True)
18        self.assertEqual(self.crate.is_open, True)
19        self.assertEqual(self.crate.locked, True)
20        self.assertEqual(self.crate.scripts, {})
21
22        self.assertEqual(self.crate2.ID, 'crate02')
23        self.assertEqual(self.crate2.locked, False)
24
25    # can't test containing functionality...there are no containable objects
26   
27    def test_lockable(self):
28        self.crate2.lock()
29        self.assertEqual(self.crate2.locked, True)
30        self.crate2.unlock()
31        self.assertEqual(self.crate2.locked, False)
32
33if __name__=='__main__':
34    unittest.main()
Note: See TracBrowser for help on using the repository browser.