Пример #1
0
def test_remove_actor():
    movie = Movie("Moana", 2016)
    actors = [
        Actor("Auli'i Cravalho"),
        Actor("Dwayne Johnson"),
        Actor("Rachel House"),
        Actor("Temuera Morrison")
    ]
    for actor in actors:
        movie.add_actor(actor)
    assert repr(
        movie.actors
    ) == "[<Actor Auli'i Cravalho>, <Actor Dwayne Johnson>, <Actor Rachel House>, <Actor Temuera Morrison>]"

    movie.remove_actor(Actor("Auli'i Cravalho"))
    assert repr(
        movie.actors
    ) == "[<Actor Dwayne Johnson>, <Actor Rachel House>, <Actor Temuera Morrison>]"

    movie.remove_actor(Actor("Auli'i Cravalho"))
    assert repr(
        movie.actors
    ) == "[<Actor Dwayne Johnson>, <Actor Rachel House>, <Actor Temuera Morrison>]"
Пример #2
0
def test_movie_remove_actor():
    movie1 = Movie("Moana", 2016)
    movie1.add_actor(Actor("Dwayne Johnson"))

    # correct input
    movie1.remove_actor(Actor("Dwayne Johnson"))
    assert movie1.actors == []

    # incorrect input
    movie1.add_actor(Actor("Dwayne Johnson"))
    movie1.remove_actor(Director("Dwayne Johnson"))
    assert movie1.actors == [Actor("Dwayne Johnson")]

    # removing an actor not in list
    movie1.remove_actor(Actor("Rachel House"))
    assert movie1.actors == [Actor("Dwayne Johnson")]