source: branches/active/character_customization/game/tests/test_objects_base.py @ 736

Revision 736, 2.5 KB checked in by aspidites, 8 years ago (diff)

Patch by Aspidites:

  • renamed scripts package to parpg
  • renamed parpg module to application
  • removed packaging and other related files (kept locally for reference, will reintroduce similar scripts to resolve bug #275
  • updated all import statements to respect changes above
  • Property svn:eol-style set to native
Line 
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
18import unittest
19from parpg.objects.base import GameObject, Lockable, Container, Living, \
20                            Scriptable, CharStats, Wearable, Usable, Weapon, \
21                            Destructable, Trapable, Carryable
22
23class TestObjectsBase(unittest.TestCase):
24
25    def testWildcard(self):
26        class Wildcard (GameObject, Lockable, Container, Living, Scriptable,
27                        CharStats, Wearable, Usable, Weapon, Destructable,
28                        Trapable, Carryable, ):
29            def __init__ (self, ID, *args, **kwargs):
30                self.name = 'All-purpose carry-all'
31                self.text = 'What is this? I dont know'
32                GameObject.  __init__( self, ID, **kwargs )
33                Lockable.    __init__( self, **kwargs )
34                Container.   __init__( self, **kwargs )
35                Living.      __init__( self, **kwargs )
36                Scriptable.  __init__( self, **kwargs )
37                CharStats.   __init__( self, **kwargs )
38                Wearable.    __init__( self, "left_arm", **kwargs )
39                Usable.      __init__( self, **kwargs )
40                Weapon.      __init__( self, **kwargs )
41                Destructable.__init__( self, **kwargs )
42                Trapable.   __init__( self, **kwargs )
43                Carryable.   __init__( self, **kwargs )
44        wc = Wildcard (2)
45
46        # TODO: need to fill the rest of these tests out
47
48       
49        attrs = dict(
50            openable = {"is_open":True},
51            lockable = {"locked":False},
52            carryable = {"weight":0.0, "bulk":0.0},
53            container = {"items":{}},
54            living = {"lives":True},
55            scriptable = {}
56        )
57
58        for attr in attrs:
59            assert(wc.trueAttr(attr))
60            for value in attrs[attr]:
61                self.assertEqual(getattr(wc, value), attrs[value])
Note: See TracBrowser for help on using the repository browser.