Beispiel #1
0
    def test_identifying_item(self):
        """
        Test that character can identify an item
        """
        item = (ItemBuilder()
                    .with_name('healing potion')
                    .with_appearance('blue potion')
                    .build())

        name = item.get_name(self.character)
        assert_that(name, is_(equal_to('blue potion')))

        self.character.identify_item(item)

        name = item.get_name(self.character)
        assert_that(name, is_(equal_to('healing potion')))
Beispiel #2
0
    def test_item_name_decoration(self):
        """
        Test that item can decorate its name
        """
        item = (ItemBuilder()
                    .with_name('club')
                    .build())

        self.character.inventory.append(item)
        name = item.get_name(self.character)
        assert_that(name, is_(equal_to('club')))

        self.character.weapons = [item]
        name = item.get_name(self.character, True)
        assert_that(name, is_(equal_to('club (weapon in hand)')))

        name = item.get_name(self.character, False)
        assert_that(name, is_(equal_to('club')))
Beispiel #3
0
    def test_appearance_of_unknown(self):
        """"
        Test that appearance is reported for an unknown item
        """

        item = (ItemBuilder()
                    .with_name('healing potion')
                    .with_appearance('blue potion')
                    .build())

        name = item.get_name(self.character)

        assert(name == 'blue potion')
Beispiel #4
0
    def test_appearance_of_generic_named_item(self): #pylint: disable=C0103
        """
        Test that given name is reported for a generally named item
        """
        item = (ItemBuilder()
                    .with_name('healing potion')
                    .with_appearance('blue potion')
                    .build())

        self.character.item_memory['healing potion'] = 'doozer potion'

        name = item.get_name(self.character)

        assert_that(name, is_(equal_to('doozer potion')))