def test_band_names_instances():
    Band("Beatles")
    Band("One")
    Band("Five")
    actual = len(Band.to_list())
    expected = 3
    assert expected == actual
Example #2
0
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 prep_data():
    bashar = Guitarest("Bashar")
    samer = Bassist("Samer")
    saed = Drummer("Saed")
    ahmad = Singer("Ahmad")
    band1 = (Band("Pandora Box", [ahmad, bashar, samer, saed]))
    return {'bashar': bashar, 'samer': samer, 'saed': saed, 'ahmad': ahmad}
Example #4
0
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 test_from_file():
    with open("assets/bands.json") as f:
        bands = json.loads(f.read())

    assert len(bands) == 1

    nirvana_data = bands[0]

    nirvana = Band(nirvana_data["name"], nirvana_data["members"])

    assert nirvana.name == "Nirvana"
Example #7
0
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
    }
Example #8
0
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 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_band_repr():
    nirvana = Band("Nirvana", [])
    actual = repr(nirvana)
    expected = "Band instance. name=Nirvana, members=[]"
    assert actual == expected
def test_band_name():
    nirvana = Band("Nirvana", [])

    assert nirvana.name == "Nirvana"
def test_band_repr():
    beatles = Band("Beatles")
    actual = beatles.__repr__()
    expected = "Beatles instance in Band class using repr"
    assert expected == actual
def test_band_str():
    beatles = Band("Beatles")
    actual = beatles.__str__()
    expected = "this is the string inside Band class with instance Beatles"
    assert expected == actual
def test_to_list():
    assert Band.to_list() == []
    Band("The Nobodies", [])
    assert len(Band.to_list()) == 1
def test_band_str():
    nirvana = Band("Nirvana", [])
    actual = str(nirvana)
    expected = "The band Nirvana"
    assert actual == expected
def test_band_name():
    actual = Band("Beatles").name
    expected = "Beatles"
    assert expected == actual
def test_band_name_string():
    actual = isinstance(Band(1).name,str)
    expected = True
    assert expected == actual
def test_band_members(create_band_members):
    actual = len(Band("Beatles").members)
    expected = 4
    assert expected == actual
Example #19
0
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():
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

Example #21
0
def test_to_list(allData):
    expected = Band.to_list()
    actual = allData['George'].to_list()
    assert expected == actual
Example #22
0
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 test_to_list():
    expected = [aziz, saleh, emad]
    actual = tarbanin.to_list()