def test_band_names_instances(): Band("Beatles") Band("One") Band("Five") actual = len(Band.to_list()) expected = 3 assert expected == actual
def test_band(): beatles = Band( "The Beatles", ["John Lennon", "Paul McCartney", "George Harrison"], ["Sympathy for the Devil", "Light My Fire", "Sharp Dressed Man"]) assert beatles.name == "The Beatles" assert beatles.members == [ "John Lennon", "Paul McCartney", "George Harrison" ] assert beatles.__repr__( ) == "Band(The Beatles,['John Lennon', 'Paul McCartney', 'George Harrison'],['Sympathy for the Devil', 'Light My Fire', 'Sharp Dressed Man'])" assert beatles.to_list() == "The number of Bands created: 1"
def test_some_band(some_band): assert some_band.name == "The Beatles" assert some_band.to_list() == "The number of Bands created: 2" assert some_band.__str__( ) == "Band name is 'The Beatles'; and members of the Band Are: John Lennon, Paul McCartney, Siva Mani" assert some_band.__repr__( ) == "Band(The Beatles,[Musician(John Lennon,Guitar), Musician(Paul McCartney,Bass), Musician(Siva Mani,Drums)],['Sympathy for the Devil', 'Light My Fire', 'Sharp Dressed Man'])" assert some_band.play_solos( ) == "John Lennon please play the solo: Sympathy for the Devil Paul McCartney please play the solo: Light My Fire Siva Mani please play the solo: Sharp Dressed Man" class_args = some_band.create_from_data( "pythonic_garage_band/assets/band_input.txt") from_data = Band(class_args[0], class_args[1], class_args[2]) assert from_data.name == "The Beatles" assert from_data.to_list() == "The number of Bands created: 3" assert from_data.__str__( ) == "Band name is 'The Beatles'; and members of the Band Are: John Lennon, Paul McCartney, Siva Mani" assert from_data.__repr__( ) == "Band(The Beatles,[Musician('John Lennon',Guitar), Musician('Paul McCartney',Bass), Musician('Siva Mani',Drums)],['Sympathy for the Devil', 'Light My Fire', 'Sharp Dressed Man'])" assert from_data.play_solos( ) == "John Lennon please play the solo: Sympathy for the Devil Paul McCartney please play the solo: Light My Fire Siva Mani please play the solo: Sharp Dressed Man"
def test_to_list(allData): expected = Band.to_list() actual = allData['George'].to_list() assert expected == actual
def test_to_list(): assert Band.to_list() == [] Band("The Nobodies", []) assert len(Band.to_list()) == 1