Пример #1
0
def test_all_band_solos():
    test_band = Band(
        'Test Band',
        [Guitarist('Wham'),
         Drummer('Bam'),
         Bassist('Shang-a-lang')])
    assert 'Guitar Sounds LOUD NOISES Bass Sounds ' == test_band.play_solos()
Пример #2
0
 def retrieveBands(self):
     sql = "SELECT * from band"
     cur.execute(sql)
     self.myBands = []
     for row in cur:
         b = Band()
         b.band_id = row[0]
         b.name = row[1]
         self.myBands.append(b)
def get_all_bands(data_file):
    bands_group = data_file['/bands']

    all_bands = []
    # Row = [Starting Frequency, Stopping Frequency, Resolution]
    for row in bands_group:
        current_band = Band(float(row[1]), float(row[2]), int(row[3]))
        if row[0] != '(none)':
            current_band.add_attribute('Description', row[0])
        current_band.add_attribute('Vid BW', row[4])
        current_band.add_attribute('Reference Level', row[5])
        current_band.add_attribute('Attenuation', row[6])
        all_bands.append(current_band)

    return all_bands
Пример #4
0
def get_all_bands(grouped_data):
    all_bands = []

    for frequency_range, sweeps in grouped_data[4].iteritems():
        resolution = float(frequency_range[1] - frequency_range[0]) / len(sweeps[0]['data'])
        current_band = Band(frequency_range[0], frequency_range[1], resolution)

        for sweep in sweeps:
            start_time = None
            stop_time = None
            measurements = list(sweep['data'])
            current_band.add_scan(start_time, stop_time, measurements)

        all_bands.append(current_band)

    return all_bands
Пример #5
0
def test_diff_str_output():
    test_band = Band.create_from_data(band_two)
    expected = """The Band's Name is: Louis the Child

The Members are:
Robby on Bass
Freddy on Bass
"""
    assert expected == test_band.__str__()
def get_all_bands(data_file):
    bands_group = data_file['/bands']

    all_bands = []
    # Row = [Starting Frequency, Stopping Frequency, Resolution]
    for row in bands_group:
        current_band = Band(float(row[1]), float(row[2]), int(row[3]))
        if row[0] != '(none)':
            current_band.add_attribute('Description', row[0])
        current_band.add_attribute('Vid BW', row[4])
        current_band.add_attribute('Reference Level', row[5])
        current_band.add_attribute('Attenuation', row[6])
        all_bands.append(current_band)

    return all_bands
Пример #7
0
def get_all_bands(data_file):
    bands_group = data_file['/bands']

    all_bands = []
    # Row = [Starting Frequency, Stopping Frequency, Resolution]
    for row in bands_group:
        current_band = Band(float(row[1]), float(row[2]), int(row[3]))
        all_bands.append(current_band)

    return all_bands
Пример #8
0
def test_band_by_array():
    band_array = [
        Band('Beatles', [
            Musician('John'),
            Bassist('Paul'),
            Guitarist('George'),
            Drummer('Ringo')
        ])
    ]
    assert band_array == Band.all_bands
Пример #9
0
def test_str_output():
    test_band = Band.create_from_data(band_one)
    expected = """The Band's Name is: Catfish and the Bottlemen

The Members are:
Van McCann on Guitar
Jon Barr on Drums
Benji Blakeway on Bass
Bob Hall on Guitar
"""
    assert expected == test_band.__str__()
Пример #10
0
def test_all_bands_list():
    Band.create_from_data(band_one)
    Band.create_from_data(band_two)
    expected = """The Band's Name is: Catfish and the Bottlemen

The Members are:
Van McCann on Guitar
Jon Barr on Drums
Benji Blakeway on Bass
Bob Hall on Guitar


The Band's Name is: Louis the Child

The Members are:
Robby on Bass
Freddy on Bass


"""
    assert expected == Band.to_list()
Пример #11
0
def test_multiple_bands_by_data():
    band_array = [
        Band.create_from_data(band_one),
        Band.create_from_data(band_two)
    ]
    assert band_array == Band.all_bands
Пример #12
0
def test_band_by_data():
    band_array = [Band.create_from_data(band_one)]
    assert band_array == Band.all_bands
Пример #13
0
def test_band_name():
    test_band = Band('Capital Cities')
    assert 'Capital Cities' == test_band.name
Пример #14
0
            elif choice4 == "6":
                MP.retrieveSongs()
                genre = input("enter genre")
                for song in MP.myLibrary:
                    if song.genres == genre:
                        song.playSong()

            else:
                break

    if choice == "5":
        while True:
            choice5 = input("1. add new Band 2. Play Songs to a certain Band"
                            + " 3. View all Bands 4. back:\n")
            if choice5 == "1":
                band = Band()
                band.name = input("Enter Band name:")
                bandNum = int(input("Enter # of band Members:"))
                MP.retrieveArtists()
                MP.viewArtists()
                artistsIDsList = []
                for i in range(0, bandNum):
                    artistsIDsList.append(MP.myArtists[int(input("Enter # of the artist:"))-1].artist_id)

                band.addBand(artistsIDsList)

            if choice5 == "2":
                MP.retrieveBands()
                MP.viewBands()
                bandNum = int(input("Enter # of band"))-1
                bandSongs = MP.myBands[bandNum].retrieveBandSongs()