comparison tests/test_npc.py @ 0:1fd2201f5c36

Initial commit of parpg-core.
author M. George Hansen <technopolitica@gmail.com>
date Sat, 14 May 2011 01:12:35 -0700
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1fd2201f5c36
1 #!/usr/bin/env 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 import unittest
19 from parpg.objects.actors import NonPlayerCharacter
20
21 class MockLayer(object):
22 """Mock Layer Object"""
23 def getId(self):
24 return 1
25
26 class TestNonPlayerCharacter(unittest.TestCase):
27 def setUp(self):
28 self.npc=NonPlayerCharacter(1, MockLayer(), 'Ronnie Dobbs')
29
30 def tearDown(self):
31 self.npc = None
32
33 def testTrueAttr(self):
34 """Test NPC trueAttr functionality"""
35 self.assertEqual(self.npc.trueAttr('living'), True)
36 self.assertEqual(self.npc.trueAttr('charstats'), True)
37
38 def testRepr(self):
39 """Test NPC textual representation"""
40 self.assertEqual(repr(self.npc), "<Ronnie Dobbs:1>")
41
42 def testName(self):
43 """Test NPC name"""
44 self.assertEqual(self.npc.name, "Ronnie Dobbs")
45
46 if __name__ == '__main__':
47 unittest.main()
48