def test_guiterist(): john = Guitarist("John Lennon") assert john.name == "John Lennon" assert john.get_instrument() == "Guitar" assert john.play_solo() == "Sympathy for the Devil" assert john.__str__() == "John Lennon plays Guitar" assert john.__repr__() == "Musician(John Lennon,Guitar)"
def some_band(): beatles = Band("The Beatles", [ Guitarist("John Lennon"), Bassist("Paul McCartney"), Drummer("Siva Mani") ], ["Sympathy for the Devil", "Light My Fire", "Sharp Dressed Man"]) return beatles
def one_band(): some_band = Band( "Nirvana", [ Guitarist("Kurt Cobain"), Bassist("Krist Novoselic"), Drummer("Dave Grohl"), ], ) return some_band
def allData(): bryan = Bassist("bryan", "Bassist") Yiannis_Chryssomallis = Guitarist("Yiannis_Chryssomallis") Charlie_Adams = Drummer("Charlie_Adams") George = Band("George X", [bryan, Yiannis_Chryssomallis, Charlie_Adams], "Careless Whisper") return { 'bryan': bryan, 'Yiannis_Chryssomallis': Yiannis_Chryssomallis, 'Charlie_Adams': Charlie_Adams, 'George': George }
from pythonic_garage_band import __version__ from pythonic_garage_band.pythonic_garage_band import Band, Musician, Guitarist, Bassist, Drummer import pytest def test_version(): assert __version__ == '0.1.0' ## preparing the data mike = Guitarist('mike') carlos = Drummer('carlos') john = Bassist('john') maroon5 = Band('maroon5') maroon5.add_members(mike) maroon5.add_members(carlos) maroon5.add_members(john) ######################################################################### ########## Tests ############### ######################################################################### def test_to_list(cls): expected = [mike, carlos, john] actual = maroon5.to_list() assert actual == expected
import pytest def test_version(): assert __version__ == '0.1.0' # @pytest.mark.skip(reason='Testing Count') # def test_play_solos(): # ali = Band.Guitarist('ali') # preparing data # ahmad = Band.Drummer('ahmad') # soso = Band.Bassist('soso') # expected = "ali play solo\nahmad play solo\nsoso play solo\n" # actual = soso.play_solos() # assert actual == expected aziz = Guitarist('Aziz') saleh = Drummer('Saleh') emad = Bassist('Emad') tarbanin = Band('tarbanin') tarbanin.add_members(aziz) tarbanin.add_members(saleh) tarbanin.add_members(emad) # @pytest.fixture # def prep_data(): # aziz = Band.Guitarist('Aziz') # preparing data # saleh = Band.Drummer('Saleh') # emad = Band.Bassist('Emad') # #preparing data # return {'aziz':aziz, 'saleh':saleh, 'emad':emad}
def dummy_band(): my_band = Band("Caifanes") my_band.add_member(Guitarist("Carlos Santanna")) my_band.add_member(Bassist("Sabo Romo")) my_band.add_member(Drummer("Alfonso Andre")) return my_band
def test_guitarist(): jimi = Guitarist("Jimi Hendrix") assert jimi.name == "Jimi Hendrix" assert jimi.get_instrument() == "guitar"
def test_guitarist_play_solo(): actual = Guitarist("Sirius").play_solo() expected = "I am playing my Guitar" assert expected == actual
def test_guitarist_get_instrument(): actual = Guitarist("Prongs").get_instrument() expected = "I love to play my Guitar" assert expected == actual
def test_guitarist_name(): actual = Guitarist().name expected = "unknown" assert expected == actual
def test_guitarist_name(): actual = Guitarist("Hermione").name expected = " " assert expected == actual
def create_band_members(): Musician.members = [] leah = Guitarist("Leah") ron = Drummer("Ron") hermy = Guitarist("Hermy") harry = Bassist("Harry")
def prep_data(): mahmoud=Bassist("mahmoud","Bassist") ahmad=Guitarist("ahmad","Guitarist") noor=Drummer("noor","Drummer") return {'ahmad':ahmad, 'mahmoud':mahmoud, 'noor':noor}
def test_one(prep_data): ahmad=Guitarist("ahmad","Guitarist") expected=f"This in the main Band {prep_data['ahmad'].name} will Play a solo" actual=Musician.play_solos(prep_data['ahmad']) assert expected==actual
def test_guitarist_str(): joan = Guitarist("Joan Jett") actual = str(joan) expected = "My name is Joan Jett and I play guitar" assert actual == expected
def test_guitarist_repr(): joan = Guitarist("Joan Jett") actual = repr(joan) expected = "Guitarist instance. Name = Joan Jett" assert actual == expected
def test_guitarist_str(): moony = Guitarist("Moony") actual = moony.__str__() expected = "this is the string inside Musician superclass with instance Moony" assert expected == actual
def dummy_guitarist(): return Guitarist("Carlos Santanna")
def test_guitarist_repr(): gildroy = Guitarist("Gildroy") actual = gildroy.__repr__() expected = "Gildroy" assert expected == actual
from pythonic_garage_band import __version__ from pythonic_garage_band.pythonic_garage_band import Band, Musician, Guitarist, Bassist, Drummer def test_version(): assert __version__ == '0.1.0' nemrawi = Band('nemrawi') abo_anwar = Musician('abo_anwar') shareef = Guitarist('shareef') mahmoud = Drummer('mahmoud') ali = Bassist('ali') def test_Band_band_list(): expected = [nemrawi] actual = Band.band_list assert expected == actual def test_add_members_to_list(): nemrawi.add_members('jafar') nemrawi.add_members('9ob7y') expected = ['jafar', '9ob7y'] actual = nemrawi.to_list() assert expected == actual def test_Musician_play_solo():
def test_guitarist_str(): actual = Guitarist('guitarist', 'guitar').__str__() expected = 'I am a guitarist' assert actual == expected