示例#1
0
 def setUp(self):
     self.guest = Guest("Kakashi Hetaki", 27, 22.50,
                        "Communications Breakdown")
     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)
示例#2
0
 def test_room_cant_add_guests_past_max__return_False(self):
     self.room.add_guest_to_room(Guest("Jimmy", 40))
     self.room.add_guest_to_room(Guest("Jimmy", 40))
     self.room.add_guest_to_room(Guest("Jimmy", 40))
     expected = False
     actual = self.room.add_guest_to_room(Guest("Jimmy", 40))
     self.assertEqual(expected, actual)
示例#3
0
class TestGuest(unittest.TestCase):
    def setUp(self):
        self.guest_1 = Guest("Cyril", "Yes!", "VIP", 30000, "Dddudu")
        self.guest_2 = Guest("James", "Whoop!", "Regular", 800, "Perfect")
        self.room = Room("The Wonderland", 90, 400, 0)

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

    def test_guest_has_celebration(self):
        self.assertEqual("Yes!", self.guest_1.celebration)

    def test_guest_status(self):
        self.assertEqual("VIP", self.guest_1.status)

    def test_guest_has_wallet(self):
        self.assertEqual(30000, self.guest_1.wallet)

    def test_guest_has_paid_fee(self):
        self.guest_1.pay_fee(self.room)
        self.guest_2.pay_fee(self.room)
        self.assertEqual(29600, self.guest_1.wallet)
        self.assertEqual(710, self.guest_2.wallet)

    def test_guest_has_fav_song(self):
        self.assertEqual("Dddudu", self.guest_1.favourite_song)
示例#4
0
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))
示例#5
0
class TestGuest(unittest.TestCase):
    def setUp(self):
        self.thunderstruck = Song("Thunderstruck", "AC/DC", 292, 1990, "Rock")
        self.guest = Guest("Dave", 50, self.thunderstruck)

# testing Guest attributes

    def test_guest_has_name(self):
        self.assertEqual("Dave", self.guest.name)

    def test_guest_has_favourite_song(self):
        self.assertEqual(self.thunderstruck, self.guest.favourite_song)

    def test_guest_has_wallet(self):
        self.assertEqual(50, self.guest.wallet)

# test methods

    def test_guest_pays_for_item(self):
        self.guest.pay(5)
        self.assertEqual(45, self.guest.wallet)

    def test_favourite_song_is_on_playlist(self):
        playlist = [self.thunderstruck]
        self.assertEqual("YAAAASSSS!!!!, they've got Thunderstruck!",
                         self.guest.woop_obnoxiously(playlist))

    def test_guest_can_afford_item(self):
        self.assertTrue(self.guest.can_afford_item(10))

    def test_guest_cannot_afford_item(self):
        self.assertFalse(self.guest.can_afford_item(50.01))
示例#6
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")
示例#7
0
 def test_guest_knows_theyve_left_room(self):
     guest = Guest("Ricky", 20)
     guest.changed_location()
     guest.changed_location()
     expected = False
     actual = guest.in_room
     self.assertEqual(expected, actual)
示例#8
0
 def test_check_out_guest_from_room_multiple_guests(self):
     test_guest2 = Guest("Musical Bob", 54, 700.00, "Another One Bites The Dust", 5.00)
     test_guest3 = Guest("Tone Deaf Bob", 76, 500.00, "Three Blind Mice", 50.00)
     self.room_tropical.guest_list = [self.test_guest, test_guest2, test_guest3]
     self.room_tropical.check_out_guest(test_guest2)
     self.assertEqual("Party Bob", self.room_tropical.guest_list[0].name)
     self.assertEqual("Tone Deaf Bob", self.room_tropical.guest_list[1].name)
     self.assertEqual(2, len(self.room_tropical.guest_list))
示例#9
0
 def test_room_cant_add_guests_past_max(self):
     self.room.add_guest_to_room(Guest("Jimmy", 40))
     self.room.add_guest_to_room(Guest("Jimmy", 40))
     self.room.add_guest_to_room(Guest("Jimmy", 40))
     self.room.add_guest_to_room(Guest("Jimmy", 40))
     expected = 3
     actual = len(self.room.guests)
     self.assertEqual(expected, actual)
示例#10
0
class TestGuest(unittest.TestCase):

    # Testing that classes have been Setup OK

    def setUp(self):

        self.song_1 = Song('S001', 'Nickleback', 'Faraway')
        self.song_2 = Song('S002', 'The Weekend', 'Save Your Tears')
        self.song_3 = Song('S003', 'Daxten', 'Somewhere Out There')

        playlist_1 = [self.song_1, self.song_2]

        self.guest_1 = Guest('Joey Tribbiani', 100.00, 'Entrance Hallway',
                             'S001')
        self.guest_2 = Guest('Ross Gellar', 75.00, 'Entrance Hallway', 'S002')
        self.guest_3 = Guest('Chandler Bing', 50.00, 'Pop Paradise', 'S002')

        current_visitors_1 = [self.guest_1, self.guest_2]

        self.room = Room('Pop Paradise', 30, 5.00, 0.00, current_visitors_1,
                         playlist_1)

    def test_guest_has__guest_name(self):
        self.assertEqual('Joey Tribbiani', self.guest_1.guest_name)

    def test_guest_has__wallet(self):
        self.assertEqual(100.00, self.guest_1.wallet)

    def test_guest_has__current_room(self):
        self.assertEqual('Entrance Hallway', self.guest_1.current_room)

    def test_guest_has__favourite_song(self):
        self.assertEqual('S001', self.guest_1.favourite_song)

# Testing Methods needed for adding guest to a room

# Advanced Check-in/out

    def test_guest__can_afford_fee_high_wallet(self):
        self.assertEqual(True, self.guest_1.check_affordabilty(self.room.fee))

    def test_guest__can_afford_fee_low_wallet(self):
        guest_low_wallet = Guest('Gunther', 0.00, 'Entrance Hallway', 'S005')
        self.assertEqual(False,
                         guest_low_wallet.check_affordabilty(self.room.fee))

    def test_guest__can_afford_fee_exact_wallet(self):
        guest_exact_wallet = Guest('Gunther', 5.00, 'Entrance Hallway', 'S005')
        self.assertEqual(True,
                         guest_exact_wallet.check_affordabilty(self.room.fee))

    def test_pay_fee(self):
        self.assertEqual(95.00, self.guest_1.pay_fee(self.room.fee))
        self.assertEqual(70.00, self.guest_2.pay_fee(self.room.fee))
        self.assertEqual(45.00, self.guest_3.pay_fee(self.room.fee))

    def test_set_current_room(self):
        self.assertEqual('Pop Paradise', self.guest_1.set_room('Pop Paradise'))
示例#11
0
 def test_room_has_more_guests_than_max(self):
     self.room.add_guest_to_room(Guest("Timmy", 20))
     self.room.add_guest_to_room(Guest("Timmy", 20))
     self.room.add_guest_to_room(Guest("Timmy", 20))
     self.room.add_guest_to_room(Guest("Timmy", 20))
     self.room.add_guest_to_room(Guest("Timmy", 20))
     expected = False
     actual = self.room.room_has_space()
     self.assertEqual(expected, actual)
示例#12
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")
示例#13
0
 def setUp(self):
     self.guest1 = Guest("sipho", 25, 300, 1)
     self.guest2 = Guest("Jimmy", 36, 2000, 1)
     self.guest3 = Guest("Sampson", 32, 700, 1)
     self.guest4 = Guest("Micaela", 24, 400, 1)
     self.guest5 = Guest("Jessica", 27, 70, 1)
     guests = [
         self.guest1, self.guest2, self.guest3, self.guest4, self.guest5
     ]
 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)
示例#15
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)
 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)
    def test_room_has_space(self):

        guest_1 = Guest("Ted Mosby", 35.00, "Saturday night", "Disco Room")
        guest_2 = Guest("Barney Stinson", 45.00,
                        "Eye of the tiger", "Disco Room")
        guest_3 = Guest("Lily Aldrin", 25.00, "1999", "Disco Room")
        self.room.check_in_guest(guest_1)
        self.room.check_in_guest(guest_2)
        self.room.check_in_guest(guest_3)
        self.assertEqual(False, self.room.is_room_full())
 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")
     }
示例#19
0
    def setUp(self):
        self.guest_1 = Guest("David", 150, "Jolene")
        self.guest_2 = Guest("Kyle", 100, "Lovers")
        self.guest_3 = Guest("Antonia", 200, "I should be so lucky")
        self.guest_4 = Guest("Ewen", 300, "We will rock you")

        self.room_1 = Room("The Popaoke room", 10, 15)
        self.room_2 = Room("The Countryaoke room", 6, 20)
        self.room_3 = Room("The Rockaoke room", 15, 10)
        self.room_4 = Room("The Rapaoke room", 2, 50)
示例#20
0
    def test_if_room_cleared(self):
        alice = Guest("Alice", 75)
        bob = Guest("Bob", 60)
        candice = Guest("Candice", 55)

        self.small_room.check_guest_into_room(alice)
        self.small_room.check_guest_into_room(bob)
        self.small_room.check_guest_into_room(candice)
        self.small_room.remove_all_guests()
        self.assertEqual(0, len(self.small_room.current_occupants))
示例#21
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")
    def setUp(self):

        # SONGS SETUP #
        self.song_1 = Song("2Pac", "Dear Mama")
        self.song_2 = Song("The Notorious BIG", "Juicy")
        self.song_3 = Song("The Midnight", "Los Angeles")

        # GUESTS SETUP #
        self.guest_1 = Guest("Angelo", 47, self.song_2)
        self.guest_2 = Guest("Ryan", 128, self.song_3)
        self.guest_3 = Guest("Sonia", 22, self.song_1)
示例#23
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)
示例#24
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)
示例#25
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")
示例#26
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")
示例#27
0
class TestGuest(unittest.TestCase):
    def setUp(self):
        self.guest_loud_bob = Guest("Loud Bob", 23, 200.00, "Song 2", 100.00)
        self.guest_shy_bob = Guest("Shy Bob", 18, 1000.00, "Three Blind Mice",
                                   0.00)

    def test_guest_exists(self):
        self.assertEqual("Loud Bob", self.guest_loud_bob.name)
        self.assertEqual(23, self.guest_loud_bob.age)
        self.assertEqual(200.00, self.guest_loud_bob.wallet)

    def test_guest_pays_for_room(self):
        self.guest_loud_bob.pay(15.00)
        self.assertEqual(185.00, self.guest_loud_bob.wallet)

    def test_customer_has_money_to_pay__True(self):
        entry_fee = 15.00
        self.assertEqual(True, self.guest_loud_bob.check_can_pay(entry_fee))

    def test_customer_has_money_to_pay__False(self):
        entry_fee = 201.00
        self.assertEqual(False, self.guest_loud_bob.check_can_pay(entry_fee))

    def test_guest_has_favourite_song(self):
        self.assertEqual("Song 2", self.guest_loud_bob.fav_song)

    def test_guest_can_pay_drink(self):
        test_drink = Drink("Blue Lagoon", 15.00, 4.00)
        self.guest_loud_bob.pay(test_drink.price)
        self.assertEqual(185.00, self.guest_loud_bob.wallet)

    def test_guest_can_increase_drunkeness(self):
        test_drink = Drink("Blue Lagoon", 15.00, 4.00)
        self.guest_loud_bob.increase_drunkeness(test_drink.alcohol_units)
        self.assertEqual(104.00, self.guest_loud_bob.drunkeness)
 def test_is_the_room_full(self):
     guest_1 = Guest("Ted Mosby", 35.00, "Saturday night", "Disco Room")
     guest_2 = Guest("Barney Stinson", 45.00,
                     "Eye of the tiger", "Disco Room")
     guest_3 = Guest("Lily Aldrin", 25.00, "1999", "Disco Room")
     guest_4 = Guest("Robin Scherbatsky", 50.00,
                     "Heart of glass", "Disco Room")
     guest_5 = Guest("Marshall Eriksson", 30.00,
                     "Night fever", "Disco Room")
     self.room.check_in_guest(guest_1)
     self.room.check_in_guest(guest_2)
     self.room.check_in_guest(guest_3)
     self.room.check_in_guest(guest_4)
     self.room.check_in_guest(guest_5)
     self.assertEqual(True, self.room.is_room_full())
    def setUp(self):

        self.song_1 = Song('S001', 'Nickleback', 'Faraway')
        self.song_2 = Song('S002', 'The Weekend', 'Save Your Tears')
        self.song_3 = Song('S003', 'Daxten', 'Somewhere Out There')

        playlist_1 = [self.song_1, self.song_2]

        self.guest_1 = Guest('Joey Tribbiani', 100.00, 'Entrance Hallway', 'S001')
        self.guest_2 = Guest('Ross Gellar', 75.00, 'Entrance Hallway', 'S002')
        self.guest_3 = Guest('Chandler Bing', 50.00, 'Pop Paradise', 'S002')

        current_visitors_1 = [self.guest_1,  self.guest_2]

        self.room = Room('Pop Paradise', 30, 5.00, 0.00, current_visitors_1, playlist_1)
class TestGuest(unittest.TestCase):
    def setUp(self):
        self.name_1 = Guest("Jimmy", 20)
        self.name_2 = Guest("Billy", 50)

    def test_guest_has_name(self):
        self.assertEqual("Jimmy", self.name_1.name)
        self.assertEqual("Billy", self.name_2.name)

    def test_guest_has_money(self):
        self.assertEqual(20, self.name_1.money)

    def test_remove_money(self):
        self.name_1.remove_money(5)
        self.assertEqual(15, self.name_1.money)