def test_to_list(): with open('pythonic_garage_band/twobands.json', 'r') as file: bands = json.loads(file.read()) assert len(bands) == 2 Band.create_from_data(bands[0]) Band.create_from_data(bands[1]) assert len(Band.to_list()) == 2
def harmony_band3(): harmony = Band ( "harmony", [Drummer("Sivamani"), Guitarist("Surya"), Bassist("Rehman")] ) return harmony
def test_create_bands_from_file(): with open('pythonic_garage_band/bands.json', 'r') as file: bands = json.loads(file.read()) assert len(bands) == 1 band = Band.create_from_data(bands[0]) assert band.name == "Volcano"
def some_band(): assert some_band.name == "Nirvana" nirvana = Band("Nirvana", [Guitarist("Curt Kobian"), Bassist("Kris Nov"), Drummer("Dave") ]) return nirvana
def test_band_members(): band = Band.create_from_data(BandData) assert band.name == "Volcano" assert len(band.members) == len(BandData["Members"]) for member in band.members: assert isinstance(member, Musician) assert isinstance(band.members[0], Guitarist) assert isinstance(band.members[1], Drummer) assert isinstance(band.members[2], Bassist) assert band.members[0].name == "Tom" assert band.members[1].name == "Robert" assert band.members[2].name == "Riley"
def some_band(): nirvana = Band("Nirvana", [Guitarist("Curt Kobain"), Bassist("Kris, Novoselic"), Drummer("Dave Grohl")]) return nirvana
def test_band_name(): nirvana = Band("Nirvana", []) assert nirvana.name == "Nirvana"
def test_to_list(): assert Band.to_list() == [] Band("The Nobodies", []) assert len(Band.to_list()) == 1
def one_band(): some_band = Band( "Nirvana", [Guitarist("Kurt Cobain"), Bassist("Krist Novoselic"), Drummer("Dave Grohl"),], ) return some_band
def test_create_bands(): Band.create_from_data('pythonic_garage_band\\assets\\bands.yaml') assert str(Band.to_list()[0]) == "The band Band1" assert str(Band.to_list()[1]) == "The band Band2" assert repr(Band.to_list()[0]) == "The band instance with name = Band1, members = [Bassist instance. Name: Simon, Guitarist instance. Name: Krishnan]" assert repr(Band.to_list()[1]) == "The band instance with name = Band2, members = [drummer instance. Name: Vara, Guitarist instance. Name: JB]"
def test_band_to_list(): test_band1 = Band("test",[Guitarist("test1")]); assert len(test_band1.to_list())>0
def test_band_play_solo(): test_band = Band("test",[Guitarist("test1"),Bassist("test2")]); assert test_band.play_solos() == ["test1 Playing solo guitar","test2 Playing solo bass"]
def test_band_members(): test_band = Band("test",[Guitarist("test1"),Bassist("test2")]); assert test_band.members[0].name == "test1" assert test_band.members[0].instrument == "Guitar" assert test_band.members[1].name == "test2" assert test_band.members[1].instrument == "Bass"
def test_band_name(): test_band = Band("test"); assert test_band.name == "test"
def test_band_list(): assert Band.to_list() == [] slipknot = Band('Slipknot', '[Corey, James]') assert len(Band.to_list()) == 1