def setUp(self): closet = Dresser() closet.name = closet.id = 'closet' outer = Dresser() outer.id = outer.name = 'outer' chair = Chair() room = Room(name='room', objects=[outer, chair], exits={}, description='a room.') self.game = Game() self.game.game['rooms'] = [room] self.game.game['location'] = room self.game.game['inv'] = [] self.game.all_objs = [outer, closet, chair] self.base = deepcopy(self.game)
def __init__(self): bed = Bed() lamp = UnreachableLamp() dresser = Dresser() chair = Chair() Bedroom = Room(name='Bedroom', objects=[bed, lamp, dresser], description='A homey room with blue wallpaper \ and old-fashioned scenes hanging from brass frames. There is a large four-poster against one wall \ and a small dresser in the corner.', exits={}) Closet = Room(name='Closet', objects=[chair], description='Significantly colder than the bedroom, \ the closet has a slanted roof that only makes it feel more cramped', exits={}) Bedroom.exits['west'] = Closet Closet.exits['east'] = Bedroom self.all_objs = [bed, lamp, dresser, chair] self.game = { 'rooms': [Bedroom, Closet], 'inv': [], 'location': Bedroom }
def test_equality(self): "Two rooms should be considered equal if they have the same name, description, objects, and exits" name, desc, exits = self.room.name, self.room.description, self.room.exits objs = [Dresser(), Lamp(), Bed()] other_room = Room(name, objs, desc, exits) # equal self.assertTrue(self.room == other_room) other_room.objects.pop() # not equal self.assertFalse(self.room == other_room)
def setUp(self): self.dresser = Dresser() self.bed = Bed() self.lamp = Lamp() self.chair = Chair() self.room = Room(name="Room", objects=[self.dresser, self.bed, self.lamp], description="A room.", exits={}) self.southern_room = Room(name='', objects=[], description='', exits={'north': self.room}) self.room.exits['south'] = self.southern_room
def setUp(self): self.dresser = Dresser() self.bed = Bed() self.lamp = Lamp() self.unreachable_lamp = UnreachableLamp() self.chair = Chair()