コード例 #1
0
ファイル: guest_test.py プロジェクト: portypy/Caraoke_bar_w2
class TestGuest(unittest.TestCase):
    def setUp(self):
        self.guest_1 = Guest("Pierre", 50, "Gotta Go")
        self.guest_2 = Guest("Alexander", 40, "On My Radio")
        self.guest_3 = Guest("Pepe", 30, "Divorce a I'ltalienne")
        self.guest_4 = Guest("Edi", 5, "Gotta Go")

        self.room_1 = Room("Bongo", 3, 20)
        self.room_2 = Room("Studio 24", 5, 30)

        self.song_1 = Song("Gotta Go", "Agnostic Front", 3.2)
        self.song_2 = Song("On My Radio", "Selecter", 3.52)
        self.song_3 = Song("Divorce a I'ltalienne", "Mungo's Hifi", 3.46)

    def test_guest_has_name(self):
        self.assertEqual("Pierre", self.guest_1.name)

    def test_guest_has_money(self):
        self.assertEqual(30, self.guest_3.cash)

    def test_guest_paying_entry_decreases_cash(self):
        self.guest_1.pay_entry_fee(self.guest_1, self.room_1)
        self.assertEqual(30, self.guest_1.cash)

    def test_if_guest_fav_song_is_in_room(self):
        self.room_1.add_song_to_list(self.song_1, self.room_1)
        self.room_1.add_song_to_list(self.song_2, self.room_1)
        self.assertEqual(
            "Whoo!", self.guest_1.fav_song_in_room(self.guest_1, self.room_1))
 def setUp(self):
     self.song_1 = Song("Senorita-Camila cabelle")
     self.song_2 = Song("Dance Monkey")
     self.song_3 = Song("Someone you loved")
     self.song_4 = Song("Memories-Maroon 5")
     self.song_5 = Song("Shape of you")
     self.room = Room("The CodeClan Caraoke", 900.00, 20.00)
コード例 #3
0
    def setUp(self):
        self.guest_list = [
            Guest("Abbie"),
            Guest("Bob"),
            Guest("Carol"),
            Guest("Dave"),
            Guest("Emma"),
            Guest("Fred")
        ]

        self.room_1 = Room("Opium")
        self.room_2 = Room("Hive")

        self.song_list_1 = [
            Song("Mr. Brightside", "The Killers", "Rock"),
            Song("Back in Black", "AC/DC", "Rock"),
            Song("Walk", "Pantera", "Metal"),
            Song("Aerials", "System of a Down", "Metal"),
            Song("Welcome to the Jungle", "Guns N' Roses", "Rock")
        ]

        self.song_list_2 = [
            Song("Gold Digger", "Kanye West", "Hip hop"),
            Song("Shape of You", "Ed Sheeran", "Pop"),
            Song("Wannabe", "The Spice Girls", "Pop"),
            Song("I Write Sins Not Tragedies", "Panic! at the Disco",
                 "Pop Punk"),
            Song("Wake Me Up", "Avicii", "Dance")
        ]
コード例 #4
0
    def setUp(self):
        self.room = Room("The Wonderland", 90, 400, 0)

        self.guest_1 = Guest("Cyril", "Yes!", "VIP", 30000, "Dddudu")
        self.guest_2 = Guest("Max", "Yayy", "Regular", 400, "Perfect")
        self.guest_3 = Guest("David", "Grmm", "VIP", 300, "See you again")
        self.guest_4 = Guest("Daniel", "Whoop", "VIP", 8000, "Gucci")

        self.song_1 = Song("Dddudu", "Blackpink")
        self.song_2 = Song("Perfect", "Ed sheeran")
        self.song_3 = Song("Gucci", "Jessie")

        red_wine = Bar("Red Wine", 300)
        jack_daniels = Bar("Jack Daniels", 200)
        johnny_walker = Bar("Johnny Walker", 400)
        water = Bar("Water", 10)

        self.vip_drinks = [{
            "Drink": red_wine,
            "quantity": 9
        }, {
            "Drink": jack_daniels,
            "quantity": 4
        }, {
            "Drink": johnny_walker,
            "quantity": 5
        }, {
            "Drink": water,
            "quantity": 50
        }]
コード例 #5
0
class TestRoom(unittest.TestCase):
    def setUp(self):

        self.room1 = Room("Stars Hollow", 10)

        self.guest1 = Guest("Sally Owens")

        self.song1 = Song("Folsom Prison Blues", "Johnny Cash",
                          "Rock and roll")

    def test_room_has_name(self):
        self.assertEqual("Stars Hollow", self.room1.name)

    def test_room_has_capacity(self):
        self.assertEqual(10, self.room1.capacity)

    def test_number_of_guests(self):
        self.assertEqual(0, self.room1.number_of_guests())

    def test_guest_checked_in(self):
        self.room1.check_in_guests(self.guest1)
        self.assertEqual(1, self.room1.number_of_guests())

    def test_guest_checked_out(self):
        self.room1.check_out_guests(self.guest1)
        self.assertEqual(0, self.room1.number_of_guests())

    def test_song_added(self):
        self.room1.add_song(self.song1)
        self.assertEqual(1, self.room1.number_of_songs())
コード例 #6
0
 def setUp(self):
     #to be populated with parameters we need to test within the rooms tests.
     self.room_1 = Room(1, 10)
     self.room_2 = Room(2, 8)
     self.karaoke_bar = Karaoke
     self.guest = Guest("John Brown", 5)
     self.room = Room
コード例 #7
0
 def setUp(self):
     self.room_1 = Room("Pink_room", 30, 400.00)
     self.room_2 = Room("Blue_room", 15, 200.00)
     self.song_1 = Song("Halo", "Beyonce")
     self.song_2 = Song("Living la vida loca", "Ricky Martin")
     self.guest = Guest("Superman", 600, "Bootilicious")
     self.guest2 = Guest("Mariah", 750, "All I want for Christmas")
コード例 #8
0
    def setUp(self):

        self.room1 = Room("Stars Hollow", 10)

        self.guest1 = Guest("Sally Owens")

        self.song1 = Song("Folsom Prison Blues", "Johnny Cash",
                          "Rock and roll")
コード例 #9
0
ファイル: test_Door.py プロジェクト: elunna/labhack
def test_facing_other__facing_away_horizontally():
    r1 = Room(0, 0, 3, 3)
    d1 = Door(r1, 0, 1)  # Facing west

    r2 = Room(5, 0, 3, 4)
    d2 = Door(r2, 7, 1)  # Facing east
    assert d1.facing_other(d2) is False  # Lined up horizontally
    assert d2.facing_other(d1) is False  # Lined up horizontally
コード例 #10
0
ファイル: test_Door.py プロジェクト: elunna/labhack
def test_facing_other__facing_away_vertically():
    r1 = Room(0, 0, 3, 3)
    d1 = Door(r1, 1, 0)  # Facing N

    r2 = Room(0, 5, 4, 3)
    d2 = Door(r2, 1, 7)  # Facing S
    assert d1.facing_other(d2) is False  # Lined up vertically
    assert d2.facing_other(d1) is False  # Lined up vertically
コード例 #11
0
 def test_room_capacity(self):
     new_guest = Guest('Jimmy', 20)
     room_1 = Room('The Heavy Room')
     guest = [new_guest]
     max_guests = guest * 51
     for guest in max_guests:
         room_1.check_in_guest(guest)
     self.assertEqual(50, len(room_1.room_guests))
コード例 #12
0
 def setUp(self):
     self.person_1 = Guest("Singy McSingface", 36, 50,
                           "Never Gonna Give You Up", "Beer")
     self.person_2 = Guest("Dancy McDanceface", 30, 60, "Sandstorm", "Wine")
     self.song_1 = Song("Never Gonna Give You Up", "Rick Astley", "Pop")
     self.song_2 = Song("Sandstorm", "Darude", "Dance")
     self.room = Room("Room 1", 5, 10)
     drinks = {"Beer": 4, "Wine": 8, "Whiskey": 5, "Vodka": 2}
     self.bar = Bar("Karaoke Bar", 100, drinks)
コード例 #13
0
 def setUp(self):
     #to be populated with parameters we need to test within the karaoke tests.
     self.karaoke_bar = Karaoke("Hokey Karaoke")
     self.guest_1 = Guest("John Brown", 5.00)
     self.guest_2 = Guest("Gordon Lilley", 25.00)
     self.song_1 = Song ("band on the run")
     self.song_2 = Song ("shiny happy people")
     self.room_1 = Room(1, 10)
     self.room_2 = Room(2, 8)
コード例 #14
0
ファイル: server.py プロジェクト: AldairCoronel/Py-chat
 def create_room(self, roomName, client):
     """recibe nombre de sala, cliente y crea una sala"""
     if self.verify_chat_room_duplicate(roomName):
         room = Room(roomName, client.get_socket())
         room.add_member(client.get_socket())
         self.rooms.append(room)
         self.send_message('Sala creada exitosamente.', client.get_socket())
     else:
         self.send_message('Ya existe una sala con ese nombre.', client.get_socket())
コード例 #15
0
 def setUp(self):
     self.room_1 = Room("Party Palace", 10, 6.00)
     self.room_2 = Room("Cosy Coop", 2, 14.00)
     self.guest_1 = Guest("Yeller Young", 25.00, "The Chain")
     self.guest_2 = Guest("Tuneful Tina", 32.00, "Dancing Queen")
     self.guest_3 = Guest("Metal Mickey", 10.00, "Enter Sandman")
     self.song_1 = Songs("The Chain", "Fleetwood Mac")
     self.song_2 = Songs("Club Tropicana", "Wham!")
     self.song_3 = Songs("Wind of Change", "Scorpion")
コード例 #16
0
ファイル: test_Door.py プロジェクト: elunna/labhack
def test_facing_other__doors_lined_up_horizontally():
    # These doors do not share the same x-axis, there is 1 space between them,
    # but we need at least 2 spaces for them to be facing eachother.
    r1 = Room(0, 0, 3, 3)
    d1 = Door(r1, 2, 1)  # Facing east

    r2 = Room(3, 4, 3, 3)
    d2 = Door(r2, 3, 5)  # Facing west
    assert d1.facing_other(d2)
    assert d2.facing_other(d1)
コード例 #17
0
ファイル: test_Door.py プロジェクト: elunna/labhack
def test_facing_other__doors_lined_up_vertically():
    # These doors do not share the same y-axis, there is 1 space between them,
    # but we need at least 2 spaces for them to be facing eachother.
    r1 = Room(0, 0, 3, 3)
    d1 = Door(r1, 1, 2)  # Facing south

    r2 = Room(4, 3, 3, 3)
    d2 = Door(r2, 5, 3)  # Facing north
    assert d1.facing_other(d2)
    assert d2.facing_other(d1)
コード例 #18
0
 def setUp(self):
     self.song_1 = Song("Nirvava - Smells like teen spirit")
     self.song_2 = Song("Bob Dylan - Like A Rolling Stone")
     self.guest_1 = Guest("Dougal", 50)
     self.guest_2 = Guest("Hamish", 70)
     self.guest_3 = Guest("Donny", 3)
     songs_1 = [self.song_1, self.song_2]
     songs_2 = []
     self.room_1 = Room("Rock", songs_1, 5)
     self.room_2 = Room("Dance", songs_2, 8)
コード例 #19
0
ファイル: test_room.py プロジェクト: evamaina/Dojo-Lab
    def test_add_person(self):
        """calling add_person method to add a new person to the office
        thus reducing the capacity of office to 5"""
        Room.add_person(self.new_office, self.new_staff)
        self.assertEqual(self.new_office.room_capacity, 5)
        """calling add_person method to add a new person to the living
        space thus reducing the capacity of the living space to 3"""

        Room.add_person(self.new_living_Space, self.new_fellow)
        self.assertEqual(self.new_living_Space.room_capacity, 3)
コード例 #20
0
 def setUp(self):
     self.room_1 = Room("Pop", 12.00, 4)
     self.room_2 = Room("Rock", 10.00, 6)
     self.room_3 = Room("Country", 10.00, 6)
     self.guest_1 = Guest("Alan Partridge", 80.00, "Cuddly Toy")
     self.guest_2 = Guest("Dan Moody", 100.00, "Let's Get It On")
     self.guest_3 = Guest("Geordie Michael", 60.00, "Back in the USSR")
     self.guest_4 = Guest("Tex", 60.00, "Whiskey In The Jar")
     self.guest_5 = Guest("Lynn Benfield", 120.00, "9 to 5")
     self.song_1 = Song("Cuddly Toy")
コード例 #21
0
 def setUp(self):
     self.room = Room("Super Stars", 100.00, 2, 5.00)
     self.guest = Guest("Monica", 40.00, "I Will Survive")
     self.rich_guest = Guest("Pheobe", 70.00, "Dancing Queen")
     self.poor_guest = Guest("Chandler", 4.00, "Sweet Caroline")
     self.songs = { 
         "Dancing Queen": Song("Dancing Queen", "ABBA"),
         "I Will Survive": Song("I Will Survive", "Gloria Gaynor"),
         "Sweet Caroline": Song("Sweet Caroline", "Neil Diamond")
     }
コード例 #22
0
 def setUp(self):
     self.room = Room()
     self.songs = [
         Song("Africa", "Toto"),
         Song("Don't Stop Believin'", "Journey"),
         Song("Wonderwall", "Oasis"),
         Song("Uptown Girl", "Billy Joel"),
         Song("Ring of Fire", "Johnny Cash"),
     ]
     self.guest = Guest("Timmy", 20)
     self.guest_not_in_room = Guest("Jimmy", 40)
コード例 #23
0
ファイル: test_Door.py プロジェクト: elunna/labhack
def test_facing_other__horizontal():
    r1 = Room(0, 0, 3, 3)
    d1 = Door(r1, 2, 1)

    r2 = Room(5, 0, 3, 4)
    d2 = Door(r2, 5, 1)
    d3 = Door(r2, 5, 2)
    assert d1.facing_other(d2)  # Lined up horizontally
    assert d2.facing_other(d1)  # Lined up horizontally
    assert d1.facing_other(d3)  # Off by one
    assert d3.facing_other(d1)  # Off by one
コード例 #24
0
ファイル: test_Door.py プロジェクト: elunna/labhack
def test_facing_other__vertical():
    r1 = Room(0, 0, 3, 3)
    d1 = Door(r1, 1, 2)

    r2 = Room(0, 5, 4, 3)
    d2 = Door(r2, 1, 5)
    d3 = Door(r2, 2, 5)
    assert d1.facing_other(d2)  # Lined up vertically
    assert d2.facing_other(d1)  # Lined up vertically
    assert d1.facing_other(d3)  # Off by one
    assert d3.facing_other(d1)  # Off by one
コード例 #25
0
 def setUp(self):
     self.room = Room(1, 7.00)
     self.guest = Guest("Kakashi Hetaki", 27, 22.50,
                        "Communications Breakdown")
     self.guest_2 = Guest("Asuma Sarutobi", 28, 17.00, "Lotta Years")
     self.guest_3 = Guest("Jiraiya", 51, 47.00, "Brown Eyed Girl")
     self.guest_4 = Guest("Shikamaru Nara", 18, 5.00, "Emerald")
     self.song = Song("Aesop Rock", "Lotta Years", 50)
     self.song_2 = Song("Jon Hopkins", "Emerald", 0)
     self.song_3 = Song("Led Zeppelin", "Communications Breakdown", 100)
     self.song_4 = Song("Aesop Rock", "None Shall Pass", 150)
コード例 #26
0
 def setUp(self):
     self.room_1 = Room("CBGB", 25.00)
     self.song_1 = Song("Juice", "Lizzo")
     self.song_2 = Song("Dr Dre", "Forgot About Dre")
     self.song_3 = Song("David Byrne", "Finite=Alright")
     self.song_4 = Song("Portishead", "Glory Box")
     self.guest_1 = Guest("Mick", "Jagger", 20, 12000.00, "Gimme Shelter")
     self.guest_2 = Guest("Justin", "Bieber", 16, 0.82, "Sorry")
     self.guest_3 = Guest("Joni", "Mitchell", 21, 100.00, "Juice")
     self.guest_4 = Guest("Susan", "Boyle", 47, 36.42, "F**k tha Police")
     self.guest_5 = Guest("Courtney", "Love", 31, 666.66,
                          "Getting Away With It")
コード例 #27
0
    def setUp(self):
        self.room_1 = Room("Bongo", 3, 20)
        self.room_2 = Room("Studio 24", 5, 30)

        self.guest_1 = Guest("Pierre", 50, "Gotta Go")
        self.guest_2 = Guest("Alexander", 40, "On My Radio")
        self.guest_3 = Guest("Pepe", 30, "Divorce a I'ltalienne")
        self.guest_4 = Guest("Edi", 5, "Gotta Go")

        self.song_1 = Song("Gotta Go", "Agnostic Front", 3.2)
        self.song_2 = Song("On My Radio", "Selecter", 3.52)
        self.song_3 = Song("Divorce a I'ltalienne", "Mungo's Hifi", 3.46)
コード例 #28
0
    def setUp(self):

        self.room_1 = Room("Bongo", 3, 20)
        self.room_2 = Room("Studio 24", 5, 30)

        self.guest_1 = Guest("Pierre", 50, "Gotta Go")
        self.guest_2 = Guest("Alexander", 40, "On My Radio")
        self.guest_3 = Guest("Pepe", 30, "Divorce a I'ltalienne")
        self.guest_4 = Guest("Edi", 5, "Gotta Go")

        self.book = Book("For taxation purposes")
        self.hiden_book = Book("Real income")
コード例 #29
0
    def create_room(self, conn):
        logger.info('createing a room...')
        while True:
            i = self.random_id()
            if self.check_id(i):
                break

        logger.info('random a room id -> %s', i)

        room = Room(i)
        room.channel = conn
        self._rlist[i] = room
コード例 #30
0
    def setUp(self):
        self.song_1 = Song("Ice Ice Baby", "Vanilla Ice")
        self.song_2 = Song("Greatest Day", "Take That")
        self.song_3 = Song("Especially for You", "Kylie and Jason")

        self.songs = [self.song_1, self.song_2, self.song_3]

        self.nevan = Guest("Nevan", self.song_1)
        self.inaya = Guest("Inaya", self.song_2)
        self.olly = Guest("Olly", self.song_3)

        self.guests = [self.nevan, self.inaya, self.olly]
        self.room = Room("The Cheesy Pop Room")
コード例 #31
0
class RoomDefinition:
    def __init__(self):
        from src.room import Room
        self.room = Room()
        self.defs = self.room.defs
        
    def make_room(self):
        return self.room.copy()
        
    def add_rule(self,*args,**kwargs):
        self.room._rules.add_rule(*args,**kwargs)
    
    def add_player(self,x,y,orig_obj):
        obj = orig_obj.copy()
        self.room.map.create_char_at(x,y,obj)
        self.room.player = obj

    def create_obj_at(self,x,y,orig_obj):
        self.room.map.create_obj_at(x,y,orig_obj.copy())

    def make_map_from_key(self,init_map_str,charkey_func):
        char_map = init_map_str.splitlines()
        tuple_at = lambda char,x,y : tuple( obj.copy() for obj in charkey_func(char,x,y) )
        init_map_tuples = ( ( tuple_at(char,x,y) for x, char in enumerate(line) ) for y,line in enumerate(char_map) ) 
        # assert all( len(tup)<=2 for line in init_map_tuples for tup in line ) # assuming everything (floor) or (floor, wall), if not need a slightly better initialisation
        self.room.map.make_map_from_tuples(init_map_tuples)

    def add_obj_templates(self,default_props={}, **kwargs):
        self.room.defs.update( { key: obj.update(key=key,**default_props) for key, obj in kwargs.iteritems() } )
コード例 #32
0
def before_dig(entity, location, target, dir, behavioured):
    if not dir or dir == DIR.NONE:
       log.bug("none dir dig: %s" % dir)
       return

    # Impedisco di andare up come scavo
    if dir == DIR.UP:
        return

    # get_destination_room ritorna None se non vi è nessuna coordinata
    # valida in quella direzione
    dig_dest = location.get_destination_room(dir)
    if dig_dest:
       #log.bug("il get_destination nella dir specificata è: %s" % dig_dest)
       return

    new_room = Room(random.choice(PROTO_ROOMS_TEMPORARY_CODES))
    coords = "%d %d %d" % (location.x + dir.shift[0], location.y + dir.shift[1], location.z + dir.shift[2])
    new_room.to_area(database["areas"]["miniere-kezaf"], coords)
    defer_random_time(30, 60, descr_modify, new_room)

    # Crea la nuova uscita da zero
    exit = Exit(dir)
    location.exits[dir] = exit
    destination = Destination(location.x + dir.shift[0], location.y + dir.shift[1], location.z + dir.shift[2], "miniere-kezaf")
    if destination:
        exit.destination = destination

    reverse_exit = Exit(dir.reverse_dir)
    new_room.exits[dir.reverse_dir] = reverse_exit
    current_location = Destination(location.x, location.y, location.z, "miniere-kezaf")
    if current_location:
        reverse_exit.destination = current_location

    entity.act("\nSei riuscit$o a procedere per un certo tratto.\n", TO.ENTITY)
    entity.act("\n$n ha scavato per un certo tratto.\n", TO.OTHERS)
    return True
コード例 #33
0
ファイル: wild.py プロジェクト: Carlovan/aaritmud
def create_wild_room(area, coords):
    if not area:
        log.bug("area non è un parametro valido: %r" % area)
        return False

    if not coords:
        log.bug("coords non è un parametro valido: %r" % coords)
        return False

    # -------------------------------------------------------------------------

    from src.room import Room

    if not area.wild:
        log.bug("Non è bene chiamare questa funzionese l'area non è una wild: %s" % area.code)
        return None

    global wild_width
    global wild_height
    global wild_altitudes
    global wild_sectors

    # Se le coordinate richieste sforano quelle della wild allora non crea la stanza
    x, y, z = coords.split()
    if int(x) >= area.wild.width:
        return None
    if int(y) >= area.wild.height:
        return None

    # (TD) da cambiare a seconda della tipologia di settore
    room = Room("limbo_room_void_1")
    for direction in (DIR.NORTH, DIR.EAST, DIR.SOUTH, DIR.WEST):
        room.exits[direction] = Exit(direction)
    room.inject_to_area(area, coords)

    return room
コード例 #34
0
 def __init__(self):
     from src.room import Room
     self.room = Room()
     self.defs = self.room.defs