changeset 95:18b641968285

Removed old tests.
author KarstenBock@gmx.net
date Wed, 21 Sep 2011 16:42:30 +0200
parents 0a2cc748d16b
children 137045aa4d73
files tests/test_carryable_container.py tests/test_console.py tests/test_crate.py tests/test_dialogueprocessor.py tests/test_game_object.py tests/test_inventory.py tests/test_living.py tests/test_npc.py tests/test_objects_base.py tests/test_openable.py tests/test_scriptable.py tests/test_single_item_container.py tests/test_wearable.py
diffstat 13 files changed, 0 insertions(+), 1079 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test_carryable_container.py	Wed Sep 21 16:12:19 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-
-# This file is part of PARPG.
-#
-# PARPG is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# PARPG is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
-
-import unittest
-from parpg.objects.base import GameObject, Carryable
-from parpg.objects.composed import CarryableContainer
-
-class  TestCarryableContainer(unittest.TestCase):
-
-    class CarryableObject (GameObject, Carryable):
-        def __init__ (self, ID, **kwargs):
-            GameObject.__init__(self, ID, **kwargs)
-            Carryable.__init__(self, **kwargs)
-
-
-    def setUp(self):
-        self.item = self.CarryableObject(9)
-        self.item.weight = 9
-        self.item2 = self.CarryableObject(10)
-        self.item2.weight = 10
-
-    def tearDown(self):
-        self.item = None
-        self.item2 = None
-
-
-    def testWeight(self):
-        """ Test CarryableContainer weight calculation"""
-        container = CarryableContainer(ID=8)
-        self.assertEquals(container.weight, 0)
-        container.weight = 8
-        self.assertEquals(container.weight, 8)
-        container.placeItem(self.item)
-        print(container.items)
-        self.assertEquals(container.weight, 8+9)
-        container.placeItem(self.item2)
-        print(container.items)
-        self.assertEquals(container.weight, 8+9+10)
-        container.takeItem(self.item)
-        self.assertEquals(container.weight, 8+10)
-
-if __name__ == '__main__':
-    unittest.main()
-
--- a/tests/test_console.py	Wed Sep 21 16:12:19 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#!/usr/bin/env python
-
-#   This file is part of PARPG.
-
-#   PARPG is free software: you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation, either version 3 of the License, or
-#   (at your option) any later version.
-
-#   PARPG is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#   GNU General Public License for more details.
-
-#   You should have received a copy of the GNU General Public License
-#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
-
-
-import unittest
-from parpg.console import Console
-
-class test_console(unittest.TestCase):
-    def setUp(self):
-        self.con=Console(None)
-        self.invalString="Invalid command, enter help for more information"
-        pass
-    
-    def tearDown(self):
-        pass 
-
-    def testConsoleCommandHelp(self):
-        """ Test the help console command """
-        
-        self.assertNotEqual(self.con.handleHelp("help"),self.invalString)
-        self.assertNotEqual(self.con.handleConsoleCommand("help"),
-                            self.invalString)
-
-    def testConsoleCommandPython(self):
-        """ Test the python console command """ 
-        self.assertEqual(self.con.handlePython("python 1+1"),"2")
-        self.assertEqual(self.con.handleConsoleCommand("python 1+1"),"2")
-       
-    def testInvalid(self):
-        """Test an invalid console command """
-
-        self.assertEqual(self.con.handleConsoleCommand("invalid"),
-                         self.invalString)
-
--- a/tests/test_crate.py	Wed Sep 21 16:12:19 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-#!/usr/bin/env python
-
-#   This file is part of PARPG.
-
-#   PARPG is free software: you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation, either version 3 of the License, or
-#   (at your option) any later version.
-
-#   PARPG is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#   GNU General Public License for more details.
-
-#   You should have received a copy of the GNU General Public License
-#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
-
-import unittest
-from parpg.objects.containers import WoodenCrate
-
-class TestWoodenCrate(unittest.TestCase):
-    def setUp(self):
-        self.crate = WoodenCrate(ID='crate01')
-        self.crate2 = WoodenCrate(ID='crate02', locked=True)
-
-    def testCreation(self):
-        """ Test the WoodenCrate creation"""
-        self.assertEqual(self.crate.ID, 'crate01')
-        self.assertEqual(self.crate.name, 'Wooden Crate')
-        self.assertEqual(self.crate.text, 'A battered crate')
-        self.assertEqual(self.crate.gfx, 'crate')
-        self.assertEqual(self.crate.coords, (0.0, 0.0))
-        self.assertEqual(self.crate.map_id, None)
-        self.assertEqual(self.crate.blocking, True)
-        self.assertEqual(self.crate.is_open, True)
-        self.assertEqual(self.crate.locked, False)
-        self.assertEqual(self.crate.parpg, {})
-
-        self.assertEqual(self.crate2.ID, 'crate02')
-        self.assertEqual(self.crate2.locked, True)
-
-    # can't test containing functionality...there are no containable objects
-
-    def testLockable(self):
-        """ Test the WoodenCrate lockability"""
-        self.crate.lock()
-        self.assertEqual(self.crate.locked, True)
-        self.crate.unlock()
-        self.assertEqual(self.crate.locked, False)
--- a/tests/test_dialogueprocessor.py	Wed Sep 21 16:12:19 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,412 +0,0 @@
-#!/usr/bin/env python
-#
-#   This file is part of PARPG.
-#
-#   PARPG is free software: you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation, either version 3 of the License, or
-#   (at your option) any later version.
-#
-#   PARPG is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#   GNU General Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License
-#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
-try:
-    # Python 2.6
-    import unittest2 as unittest
-except:
-    # Python 2.7
-    import unittest
-
-from parpg.common.utils import dedent_chomp
-from parpg.dialogueprocessor import DialogueProcessor
-# NOTE Technomage 2010-12-08: Using the dialogue data structures might be a
-#    violation of unit test isolation, but ultimately they are just simple
-#    data structures that don't require much testing of their own so I feel
-#    that it isn't a mistake to use them.
-from parpg.dialogue import (Dialogue, DialogueSection, DialogueResponse,
-    DialogueGreeting)
-
-class MockDialogueAction(object):
-    keyword = 'mock_action'
-    
-    def __init__(self, *args, **kwargs):
-        self.arguments = (args, kwargs)
-        self.was_called = False
-        self.call_arguments = []
-    
-    def __call__(self, game_state):
-        self.was_called = True
-        self.call_arguments = ((game_state,), {})
-
-
-class TestDialogueProcessor(unittest.TestCase):
-    """Base class for tests of the L{DialogueProcessor} class."""
-    def assertStateEqual(self, object_, **state):
-        """
-        Assert that an object's attributes match an expected state.
-        
-        @param 
-        """
-        object_dict = {}
-        for key in state.keys():
-            if (hasattr(object_, key)):
-                actual_value = getattr(object_, key)
-                object_dict[key] = actual_value
-        self.assertDictContainsSubset(state, object_dict)
-    
-    def setUp(self):
-        self.npc_id = 'mr_npc'
-        self.dialogue = Dialogue(
-            npc_name='Mr. NPC',
-            avatar_path='/some/path',
-            default_greeting=DialogueSection(
-                id_='greeting',
-                text='This is the root dialogue section.',
-                actions=[
-                    MockDialogueAction('foo'),
-                ],
-                responses=[
-                    DialogueResponse(
-                        text='A response.',
-                        next_section_id='another_section',
-                    ),
-                    DialogueResponse(
-                        text='A conditional response evaluated to True.',
-                        condition='True',
-                        actions=[
-                            MockDialogueAction('foo'),
-                        ],
-                        next_section_id='another_section',
-                    ),
-                    DialogueResponse(
-                        text='A conditional response evaluated to False.',
-                        condition='False',
-                        next_section_id='another_section',
-                    ),
-                    DialogueResponse(
-                        text='A response that ends the dialogue.',
-                        next_section_id='end',
-                    ),
-                ],
-            ),
-            greetings=[
-                DialogueGreeting(
-                    id_='alternative_greeting',
-                    condition='use_alternative_root is True',
-                    text='This is an alternate root section.',
-                    responses=[
-                        DialogueResponse(
-                            text='End dialogue.',
-                            next_section_id='end',
-                        ),
-                    ],
-                ),
-            ],
-            sections=[
-                DialogueSection(
-                    id_='another_section',
-                    text='This is another dialogue section.',
-                    responses=[
-                        DialogueResponse(
-                            text='End dialogue.',
-                            next_section_id='end',
-                        ),
-                    ],
-                ),
-            ]
-        )
-        self.game_state = {'use_alternative_root': False}
-
-
-class TestInitiateDialogue(TestDialogueProcessor):
-    """Tests of the L{DialogueProcessor.initiateDialogue} method."""
-    def setUp(self):
-        TestDialogueProcessor.setUp(self)
-        self.dialogue = Dialogue(
-            npc_name='Mr. NPC',
-            avatar_path='/some/path',
-            default_greeting=DialogueSection(
-                id_='greeting',
-                text='This is the one (and only) dialogue section.',
-                responses=[
-                    DialogueResponse(
-                        text=dedent_chomp('''
-                            A response that moves the dialogue to
-                            another_section.
-                        '''),
-                        next_section_id='another_section'
-                    ),
-                    DialogueResponse(
-                        text='A response that ends the dialogue.',
-                        next_section_id='end',
-                    ),
-                ],
-            ),
-            sections=[
-                DialogueSection(
-                    id_='another_section',
-                    text='This is another section.',
-                    responses=[
-                        DialogueResponse(
-                            text='A response that ends the dialogue',
-                            next_section_id='end',
-                        )
-                    ],
-                ),
-            ]
-        )
-        self.dialogue_processor = DialogueProcessor(self.dialogue, {})
-    
-    def testSetsState(self):
-        """initiateDialogue correctly sets DialogueProcessor state"""
-        dialogue_processor = self.dialogue_processor
-        dialogue_processor.initiateDialogue()
-        
-        # Default root dialogue section should have been pushed onto the stack.
-        default_greeting = self.dialogue.default_greeting
-        self.assertStateEqual(dialogue_processor, in_dialogue=True,
-                              dialogue=self.dialogue,
-                              dialogue_section_stack=[default_greeting])
-    
-    def testEndsExistingDialogue(self):
-        """initiateDialogue ends a previously initiated dialogue"""
-        dialogue_processor = self.dialogue_processor
-        dialogue_processor.initiateDialogue()
-        valid_responses = dialogue_processor.continueDialogue()
-        dialogue_processor.reply(valid_responses[0])
-        
-        # Sanity check.
-        assert dialogue_processor.in_dialogue
-        dialogue_processor.initiateDialogue()
-        default_greeting = self.dialogue.default_greeting
-        self.assertStateEqual(dialogue_processor, in_dialogue=True,
-                              dialogue=self.dialogue,
-                              dialogue_section_stack=[default_greeting])
-
-class TestEndDialogue(TestDialogueProcessor):
-    """Tests of the L{DialogueProcessor.endDialogue} method."""
-    def setUp(self):
-        TestDialogueProcessor.setUp(self)
-        self.dialogue_processor = DialogueProcessor(self.dialogue,
-                                                    self.game_state)
-    
-    def testResetsState(self):
-        """endDialogue correctly resets DialogueProcessor state"""
-        dialogue_processor = self.dialogue_processor
-        # Case: No dialogue initiated.
-        assert not dialogue_processor.in_dialogue, \
-            'assumption that dialogue_processor has not initiated a dialogue '\
-            'violated'
-        self.assertStateEqual(dialogue_processor, in_dialogue=False,
-                              dialogue=self.dialogue,
-                              dialogue_section_stack=[])
-        # Case: Dialogue previously initiated.
-        dialogue_processor.initiateDialogue()
-        assert dialogue_processor.in_dialogue, \
-            'assumption that dialogue_processor initiated a dialogue violated'
-        dialogue_processor.endDialogue()
-        self.assertStateEqual(dialogue_processor, in_dialogue=False,
-                              dialogue=self.dialogue,
-                              dialogue_section_stack=[])
-
-
-class TestContinueDialogue(TestDialogueProcessor):
-    """Tests of the L{DialogueProcessor.continueDialogue} method."""
-    def setUp(self):
-        TestDialogueProcessor.setUp(self)
-        self.dialogue_processor = DialogueProcessor(self.dialogue,
-                                                    self.game_state)
-        self.dialogue_processor.initiateDialogue()
-        self.dialogue_action = \
-            self.dialogue.default_greeting.actions[0]
-    
-    def testRunsDialogueActions(self):
-        """continueDialogue executes all DialogueActions"""
-        dialogue_processor = self.dialogue_processor
-        dialogue_processor.continueDialogue()
-        self.assertTrue(self.dialogue_action.was_called)
-        expected_tuple = ((self.game_state,), {})
-        self.assertTupleEqual(expected_tuple,
-                              self.dialogue_action.call_arguments)
-    
-    def testReturnsValidResponses(self):
-        """continueDialogue returns list of valid DialogueResponses"""
-        dialogue_processor = self.dialogue_processor
-        valid_responses = \
-            dialogue_processor.dialogue_section_stack[0].responses
-        valid_responses.pop(2)
-        # Sanity check, all "valid" responses should have a condition that
-        # evaluates to True.
-        for response in valid_responses:
-            if (response.condition is not None):
-                result = eval(response.condition, self.game_state, {})
-                self.assertTrue(result)
-        responses = dialogue_processor.continueDialogue()
-        self.assertItemsEqual(responses, valid_responses)
-
-
-class TestGetRootDialogueSection(TestDialogueProcessor):
-    """Tests of the L{DialogueProcessor.getDialogueGreeting} method."""
-    def setUp(self):
-        TestDialogueProcessor.setUp(self)
-        self.dialogue_processor = DialogueProcessor(
-            self.dialogue,
-            {'use_alternative_root': True}
-        )
-        self.dialogue_processor.initiateDialogue()
-    
-    def testReturnsCorrectDialogueSection(self):
-        """getDialogueGreeting returns first section with true condition"""
-        dialogue_processor = self.dialogue_processor
-        dialogue = self.dialogue
-        root_dialogue_section = dialogue_processor.getDialogueGreeting()
-        expected_dialogue_section = dialogue.greetings[0]
-        self.assertEqual(root_dialogue_section, expected_dialogue_section)
-
-
-class TestGetCurrentDialogueSection(TestDialogueProcessor):
-    """Tests of the L{DialogueProcessor.getCurrentDialogueSection} method."""
-    def setUp(self):
-        TestDialogueProcessor.setUp(self)
-        self.dialogue_processor = DialogueProcessor(self.dialogue,
-                                                    self.game_state)
-        self.dialogue_processor.initiateDialogue()
-    
-    def testReturnsCorrectDialogueSection(self):
-        """getCurrentDialogueSection returns section at top of stack"""
-        dialogue_processor = self.dialogue_processor
-        expected_dialogue_section = self.dialogue.default_greeting
-        actual_dialogue_section = \
-            dialogue_processor.getCurrentDialogueSection()
-        self.assertEqual(expected_dialogue_section, actual_dialogue_section)
-
-
-class TestRunDialogueActions(TestDialogueProcessor):
-    """Tests of the L{DialogueProcessor.runDialogueActions} method."""
-    def setUp(self):
-        TestDialogueProcessor.setUp(self)
-        self.dialogue_processor = DialogueProcessor(self.dialogue,
-                                                    self.game_state)
-        self.dialogue_processor.initiateDialogue()
-        self.dialogue_section = DialogueSection(
-            id_='some_section',
-            text='Test dialogue section.',
-            actions=[
-                MockDialogueAction('foo'),
-            ],
-        )
-        self.dialogue_response = DialogueResponse(
-            text='A response.',
-            actions=[
-                MockDialogueAction('foo'),
-            ],
-            next_section_id='end',
-        )
-    
-    def testExecutesDialogueActions(self):
-        """runDialogueActions correctly executes DialogueActions"""
-        dialogue_processor = self.dialogue_processor
-        # Case: DialogueSection
-        dialogue_processor.runDialogueActions(self.dialogue_section)
-        dialogue_section_action = self.dialogue_section.actions[0]
-        self.assertTrue(dialogue_section_action.was_called)
-        expected_call_args = ((self.game_state,), {})
-        self.assertTupleEqual(expected_call_args,
-                              dialogue_section_action.call_arguments)
-        # Case: DialogueResponse
-        dialogue_processor.runDialogueActions(self.dialogue_response)
-        dialogue_response_action = self.dialogue_response.actions[0]
-        self.assertTrue(dialogue_response_action.was_called)
-        self.assertTupleEqual(expected_call_args,
-                              dialogue_response_action.call_arguments)
-
-
-class TestGetValidResponses(TestDialogueProcessor):
-    """Tests of the L{DialogueProcessor.getValidResponses} method."""
-    def setUp(self):
-        TestDialogueProcessor.setUp(self)
-        self.dialogue_processor = DialogueProcessor(self.dialogue,
-                                                    self.game_state)
-        self.dialogue_processor.initiateDialogue()
-    
-    def testReturnsValidResponses(self):
-        """getValidResponses returns list of valid DialogueResponses"""
-        dialogue_processor = self.dialogue_processor
-        valid_responses = \
-            dialogue_processor.dialogue_section_stack[0].responses
-        valid_responses.pop(2)
-        # Sanity check, all "valid" responses should have a condition that
-        # evaluates to True.
-        for response in valid_responses:
-            if (response.condition is not None):
-                result = eval(response.condition, {}, {})
-                self.assertTrue(result)
-        responses = dialogue_processor.continueDialogue()
-        self.assertItemsEqual(responses, valid_responses)
-
-
-class TestReply(TestDialogueProcessor):
-    """Tests of the L{DialogueProcessor.reply} method."""
-    def setUp(self):
-        TestDialogueProcessor.setUp(self)
-        self.dialogue_processor = DialogueProcessor(self.dialogue,
-                                                    self.game_state)
-        self.response = self.dialogue.default_greeting.responses[1]
-        self.ending_response = \
-            self.dialogue.default_greeting.responses[3]
-    
-    def testRaisesExceptionWhenNotInitiated(self):
-        """reply raises exception when called before initiateDialogue"""
-        dialogue_processor = self.dialogue_processor
-        # Sanity check: A dialogue must not have been initiated beforehand.
-        self.assertFalse(dialogue_processor.in_dialogue)
-        with self.assertRaisesRegexp(RuntimeError, r'initiateDialogue'):
-            dialogue_processor.reply(self.response)
-    
-    def testExecutesDialogueActions(self):
-        """reply correctly executes DialogueActions in a DialogueResponse"""
-        dialogue_processor = self.dialogue_processor
-        dialogue_processor.initiateDialogue()
-        dialogue_processor.reply(self.response)
-        dialogue_action = self.response.actions[0]
-        self.assertTrue(dialogue_action.was_called)
-        expected_call_args = ((self.game_state,), {})
-        self.assertTupleEqual(expected_call_args,
-                              dialogue_action.call_arguments)
-    
-    def testJumpsToCorrectSection(self):
-        """reply pushes section specified by response onto stack"""
-        dialogue_processor = self.dialogue_processor
-        dialogue_processor.initiateDialogue()
-        # Sanity check: Test response's next_section_id attribute must be refer
-        # to a valid DialogueSection in the test Dialogue.
-        self.assertIn(self.response.next_section_id,
-                      self.dialogue.sections.keys())
-        dialogue_processor.reply(self.response)
-        greeting = self.dialogue.default_greeting
-        next_section = self.dialogue.sections[self.response.next_section_id]
-        self.assertStateEqual(
-            dialogue_processor,
-            in_dialogue=True,
-            dialogue=self.dialogue,
-            dialogue_section_stack=[greeting, next_section],
-        )
-    
-    def testCorrectlyEndsDialogue(self):
-        """reply ends dialogue when DialogueResponse specifies 'end'"""
-        dialogue_processor = self.dialogue_processor
-        dialogue_processor.initiateDialogue()
-        # Sanity check: Test response must have a next_section_id of 'end'.
-        self.assertEqual(self.ending_response.next_section_id, 'end')
-        dialogue_processor.reply(self.ending_response)
-        self.assertStateEqual(dialogue_processor, in_dialogue=False,
-                              dialogue=self.dialogue,
-                              dialogue_section_stack=[])
-
-
-if __name__ == "__main__":
-    unittest.main()
--- a/tests/test_game_object.py	Wed Sep 21 16:12:19 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-
-#   This file is part of PARPG.
-
-#   PARPG is free software: you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation, either version 3 of the License, or
-#   (at your option) any later version.
-
-#   PARPG is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#   GNU General Public License for more details.
-
-#   You should have received a copy of the GNU General Public License
-#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
-
-import unittest
-from parpg.objects.base import GameObject
-
-class TestGameObject(unittest.TestCase):
-    def setUp(self):
-        self.game_object=GameObject (1, {'map':'img/test.png'},
-                           1, 1, None, True, 'Test object', 'Description')
-    
-
-    def tearDown(self):
-        self.game_object = None
-
-    def testCoords(self):
-        """ Test GameObject coordinates manipulation"""
-
-        self.assertEqual(self.game_object.coords, (1, 1))
-        self.assertEqual(self.game_object.X, 1)
-        self.assertEqual(self.game_object.Y, 1)
-        self.game_object.coords = (2,2)
-        self.assertEqual(self.game_object.X, 2.0)
-        self.assertEqual(self.game_object.Y, 2.0)
-
-    def testTrueAttr(self):
-        """ Test GameObject trueAttr functionality"""
-        
-        self.game_object.is_test=True
-        self.game_object.is_test2=False
-        self.assertEqual(self.game_object.trueAttr('test'),True)
-        self.assertEqual(self.game_object.trueAttr('test2'),False)
-        self.assertEqual(self.game_object.trueAttr('test3'),False)
-
-    def testRepr(self):
-        """ Test GameObject textual representation"""
-
-        self.assertEqual(repr(self.game_object), "<Test object:1>")
-
-
-if __name__ == '__main__':
-    unittest.main()
-
--- a/tests/test_inventory.py	Wed Sep 21 16:12:19 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-#!/usr/bin/env python
-
-# This file is part of PARPG.
-# 
-# PARPG is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# PARPG is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
-
-import unittest
-from parpg.inventory import Inventory
-from parpg.objects.base import GameObject, Carryable
-
-class  TestInventory(unittest.TestCase):
-    class CarryableObject (GameObject, Carryable):
-        def __init__ (self, ID, **kwargs):
-            GameObject.__init__(self, ID, **kwargs)
-            Carryable.__init__(self, **kwargs)
-
-    def setUp(self):
-        self.item = self.CarryableObject(12, name="TestItem1")
-        self.item.weight = 12
-        self.item2 = self.CarryableObject(13)
-        self.item2.weight = 13
-        self.inventory = Inventory()
-
-    def testPlaceTakeMove(self):
-        """Test Inventory Place/Take/Move functions"""
-        self.assertTrue(self.inventory.isSlotEmpty("backpack"))
-        self.inventory.placeItem(self.item)
-        self.assertTrue(self.item in self.inventory.getItemsInSlot("backpack").values())
-        self.assertEqual(self.inventory.weight, 12)
-        self.assertEqual(self.inventory.count(), 1)
-        self.assertFalse(self.inventory.isSlotEmpty("backpack"))
-
-        self.inventory.moveItemToSlot(self.item, "groin")
-        self.assertFalse(self.item in self.inventory.getItemsInSlot("backpack").values())
-        self.assertTrue(self.item in self.inventory.getItemsInSlot("groin").values())
-        self.assertEqual(self.inventory.count(), 1)
-        
-        self.assertRaises(ValueError, self.inventory.moveItemToSlot, self.item2, "somewhere")
-        
-        self.inventory.moveItemToSlot(self.item2, "chest")
-        self.assertEqual(self.inventory.count(),2)
-        self.assertEqual(self.inventory.weight, 12+13)
-        self.assertTrue(self.item2 in self.inventory.getItemsInSlot("chest").values())
-
-        self.inventory.takeItem(self.item)
-        self.assertEqual(self.inventory.count(),1)
-        self.assertEqual(self.inventory.weight, 13)
-
-    def testReplace(self):
-        """Test Inventory items replace each other in single-item slots"""
-        self.inventory.placeItem(self.item)
-        self.inventory.moveItemToSlot(self.item,"neck")
-        self.assertFalse(self.inventory.isSlotEmpty("neck"))
-        self.assertTrue(self.item in self.inventory.getItemsInSlot("neck").values())
-
-        self.inventory.moveItemToSlot(self.item2, "neck")
-        self.assertFalse(self.inventory.isSlotEmpty("neck"))
-        self.assertTrue(self.item2 in self.inventory.getItemsInSlot("neck").values())
-        self.assertFalse(self.item in self.inventory.getItemsInSlot("neck").values())
-
-    def testFind(self):
-        self.inventory.placeItem(self.item)
-        self.assertEqual(self.inventory.findItemByID(12), self.item)
-        self.assertEqual(self.inventory.findItemByID(13), None)
-        self.assertEqual(self.inventory.findItem(name="TestItem1"), self.item)
-        self.assertEqual(self.inventory.findItem(name="RandomName1"), None)
-        self.assertEqual(self.inventory.findItem(kind="carryable"), self.item)
-        self.assertEqual(self.inventory.findItem(kind="weapon"), None)
-
-        
-if __name__ == '__main__':
-    unittest.main()
-
--- a/tests/test_living.py	Wed Sep 21 16:12:19 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-#!/usr/bin/env python
-
-# This file is part of PARPG.
-# 
-# PARPG is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# PARPG is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
-
-import unittest
-from parpg.objects.base import Living
-
-class  TestLiving(unittest.TestCase):
-
-    def testDie(self):
-        """Test Living mixin die ability"""
-        creature = Living();
-        self.assertTrue(creature.lives)
-        creature.die()
-        self.assertFalse(creature.lives)
-
-if __name__ == '__main__':
-    unittest.main()
-
--- a/tests/test_npc.py	Wed Sep 21 16:12:19 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#!/usr/bin/env python
-
-#   This file is part of PARPG.
-
-#   PARPG is free software: you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation, either version 3 of the License, or
-#   (at your option) any later version.
-
-#   PARPG is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#   GNU General Public License for more details.
-
-#   You should have received a copy of the GNU General Public License
-#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
-
-import unittest
-from parpg.objects.actors import NonPlayerCharacter
-
-class MockLayer(object):
-    """Mock Layer Object"""
-    def getId(self):
-        return 1
-
-class TestNonPlayerCharacter(unittest.TestCase):
-    def setUp(self):
-        self.npc=NonPlayerCharacter(1, MockLayer(), 'Ronnie Dobbs')
-    
-    def tearDown(self):
-        self.npc = None
-
-    def testTrueAttr(self):
-        """Test NPC trueAttr functionality"""
-        self.assertEqual(self.npc.trueAttr('living'), True)
-        self.assertEqual(self.npc.trueAttr('charstats'), True)
-
-    def testRepr(self):
-        """Test NPC textual representation"""
-        self.assertEqual(repr(self.npc), "<Ronnie Dobbs:1>")
-
-    def testName(self):
-        """Test NPC name"""
-        self.assertEqual(self.npc.name, "Ronnie Dobbs")
-
-if __name__ == '__main__':
-    unittest.main()
-
--- a/tests/test_objects_base.py	Wed Sep 21 16:12:19 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-#!/usr/bin/env python
-
-#   This file is part of PARPG.
-
-#   PARPG is free software: you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation, either version 3 of the License, or
-#   (at your option) any later version.
-
-#   PARPG is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#   GNU General Public License for more details.
-
-#   You should have received a copy of the GNU General Public License
-#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
-
-import unittest
-from parpg.objects.base import GameObject, Lockable, Container, Living, \
-                            Scriptable, CharStats, Wearable, Usable, Weapon, \
-                            Destructable, Trapable, Carryable
-
-class TestObjectsBase(unittest.TestCase):
-
-    def testWildcard(self):
-        class Wildcard (GameObject, Lockable, Container, Living, Scriptable,
-                        CharStats, Wearable, Usable, Weapon, Destructable,
-                        Trapable, Carryable, ):
-            def __init__ (self, ID, *args, **kwargs):
-                self.name = 'All-purpose carry-all'
-                self.text = 'What is this? I dont know'
-                GameObject.  __init__( self, ID, **kwargs )
-                Lockable.    __init__( self, **kwargs )
-                Container.   __init__( self, **kwargs )
-                Living.      __init__( self, **kwargs )
-                Scriptable.  __init__( self, **kwargs )
-                CharStats.   __init__( self, **kwargs )
-                Wearable.    __init__( self, "left_arm", **kwargs )
-                Usable.      __init__( self, **kwargs )
-                Weapon.      __init__( self, **kwargs )
-                Destructable.__init__( self, **kwargs )
-                Trapable.   __init__( self, **kwargs )
-                Carryable.   __init__( self, **kwargs )
-        wc = Wildcard (2)
-
-        # TODO: need to fill the rest of these tests out
-
-        
-        attrs = dict(
-            openable = {"is_open":True},
-            lockable = {"locked":False},
-            carryable = {"weight":0.0, "bulk":0.0},
-            container = {"items":{}},
-            living = {"lives":True},
-            scriptable = {}
-        )
-
-        for attr in attrs:
-            assert(wc.trueAttr(attr))
-            for value in attrs[attr]:
-                self.assertEqual(getattr(wc, value), attrs[value])
--- a/tests/test_openable.py	Wed Sep 21 16:12:19 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-#!/usr/bin/env python
-
-#   This file is part of PARPG.
-
-#   PARPG is free software: you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation, either version 3 of the License, or
-#   (at your option) any later version.
-
-#   PARPG is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#   GNU General Public License for more details.
-
-#   You should have received a copy of the GNU General Public License
-#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
-
-import unittest
-from parpg.objects.base import Scriptable, Openable, GameObject
-
-
-class TestOpenable(unittest.TestCase):
-
-    class OpenableScriptable (GameObject, Openable, Scriptable):
-        def __init__ (self, ID, **kwargs):
-            GameObject.__init__(self, ID, **kwargs)
-            Openable.__init__(self, **kwargs)
-            Scriptable.__init__(self, **kwargs)
-
-    class OpenableNonScriptable (GameObject, Openable):
-        def __init__ (self, ID, **kwargs):
-            GameObject.__init__(self, ID, **kwargs)
-            Openable.__init__(self, **kwargs)
-    
-    def onOpen(self):
-        self.ran_on_open=True
-        
-    def onClose(self):
-        self.ran_on_close=True
-
-    def setUp(self):   
-        self.ran_on_open=False
-        self.ran_on_close=False
-    
-    def testOpenClose(self):
-        """ Test Openable mixin open-close functionality"""
-
-        self.openable = self.OpenableNonScriptable(3)
-        self.assertEqual(self.openable.is_open,True)
-
-        self.openable.close()
-        self.assertEqual(self.openable.is_open,False)
-        
-        # Duplicate close() should not lead to any ill effects
-        self.openable.close()
-        self.assertEqual(self.openable.is_open,False)
-
-        self.openable.open()
-        self.assertEqual(self.openable.is_open,True)
-
-        # Duplicate open() should not lead to any ill effects
-        self.openable.open()
-        self.assertEqual(self.openable.is_open,True)
-
-    def testScripting(self):
-        """ Test Openable mixin with scripting"""
-
-        self.openable = self.OpenableScriptable(3, parpg={'onOpen':(self.onOpen,(),{}),'onClose':(self.onClose,(),{})})
-        self.assertEqual(self.ran_on_close,False)
-        self.assertEqual(self.ran_on_open,False)
-        self.assertEqual(self.openable.is_open,True)
-        self.openable.close()
-        self.assertEqual(self.ran_on_close,True)
-        self.assertEqual(self.ran_on_open,False)
-        self.assertEqual(self.openable.is_open,False)
-        self.ran_on_close=False
-        self.openable.open()
-        self.assertEqual(self.ran_on_close,False)
-        self.assertEqual(self.ran_on_open,True)
-        self.assertEqual(self.openable.is_open,True)
-
-    def testInitiallyClosed(self):
-        """ Test Openable mixin instantiation in closed state"""
-        
-        self.openable = self.OpenableNonScriptable(3, is_open=False)
-        self.assertEqual(self.openable.is_open,False)
-        self.openable.open()
-        self.assertEqual(self.openable.is_open,True)
-
-if __name__ == '__main__':
-    unittest.main()
-
--- a/tests/test_scriptable.py	Wed Sep 21 16:12:19 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-
-# This file is part of PARPG.
-# 
-# PARPG is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# PARPG is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
-
-import unittest
-from parpg.objects.base import GameObject, Scriptable
-
-class  TestScriptable(unittest.TestCase):
-    def setUp(self):
-        self.script_ran1=False
-        self.script_ran2=False
-
-    def tearDown(self):
-        self.scriptable = None
-
-    def script1(self,param1,param2):
-        self.script_ran1=True
-        self.assertEqual(param1, 'param1')
-        self.assertEqual(param2, 'param2')
-
-    def script2(self,param3,param4):
-        self.script_ran2=True
-        self.assertEqual(param3, 'param3')
-        self.assertEqual(param4, 'param4')
-
-    def testScripting(self):
-        """Test Scriptable mixin scripting abilities"""
-        scriptable = Scriptable()
-        scriptable.runScript('script1')
-        self.assertFalse(self.script_ran1)
-        self.assertFalse(self.script_ran2)
-        scriptable = Scriptable({'script1':(self.script1,('param1',),{'param2':'param2'})})
-        scriptable.runScript('script1')
-        self.assertTrue(self.script_ran1)
-        self.assertFalse(self.script_ran2)
-        self.script_ran1=False
-        scriptable.setScript('script2', self.script2, ('param3',), {'param4':'param4'})
-        scriptable.runScript('script2')
-        self.assertTrue(self.script_ran2)
-        self.assertFalse(self.script_ran1)
-
-if __name__ == '__main__':
-    unittest.main()
-
--- a/tests/test_single_item_container.py	Wed Sep 21 16:12:19 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-#!/usr/bin/env python
-
-# This file is part of PARPG.
-# 
-# PARPG is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# PARPG is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
-
-import unittest
-from parpg.objects.base import GameObject, Carryable
-from parpg.objects.composed import SingleItemContainer
-
-class  TestSingleItemContainer(unittest.TestCase):
-
-    class CarryableObject (GameObject, Carryable):
-        def __init__ (self, ID, **kwargs):
-            GameObject.__init__(self, ID, **kwargs)
-            Carryable.__init__(self, **kwargs)
-
-
-    def setUp(self):
-        self.item = self.CarryableObject(6)
-        self.item2 = self.CarryableObject(7)
-
-    def tearDown(self):
-        self.item = None
-        self.item2 = None
-
-
-    def testPlaceTake(self):
-        """ Test SingleItemContainer Place/Take functions """
-        container = SingleItemContainer()
-        container.placeItem(self.item)
-        self.assertRaises(container.SlotBusy, container.placeItem, self.item2)
-        container.takeItem(self.item)
-        self.assertEqual(container.items, {})
-        container.placeItem(self.item2)
-
-if __name__ == '__main__':
-    unittest.main()
-
--- a/tests/test_wearable.py	Wed Sep 21 16:12:19 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-#!/usr/bin/env python
-
-# This file is part of PARPG.
-# 
-# PARPG is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# PARPG is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
-
-import unittest
-from parpg.objects.base import Wearable
-
-class  TestWearable(unittest.TestCase):
-
-    def testInit(self):
-        """Test Wearable mixin's various forms of instantiation"""
-        apparel = Wearable("head");
-        self.assertEqual(apparel.slots,("head",))
-        apparel = Wearable(("head", "shoulders"))
-        self.assertEqual(apparel.slots,("head","shoulders"))
-
-if __name__ == '__main__':
-    unittest.main()