def test_actors(): movie1 = Movie("Spirited Away", 2000) movie2 = Movie("Your Name", 2000) movie3 = Movie("Batman", 2000) movie4 = Movie(None, None) movie1.actors = [ Actor("Jack Huang"), Actor("James Huang"), Actor("Ron Huang"), Actor("Jane Tang") ] assert movie1.actors == [ Actor("Jack Huang"), Actor("James Huang"), Actor("Ron Huang"), Actor("Jane Tang") ] movie2.actors = [ Actor("Jack Huang"), "James Huang", Actor("Ron Huang"), 123456 ] assert movie2.actors == [] movie3.actors = Actor("Jack Huang") assert movie3.actors == [Actor("Jack Huang")] movie4.actors = "Jack Huang" assert movie4.actors == []
def test_add_actor(): movie1 = Movie("Spirited Away", 2000) movie1.actors = [Actor("James Huang")] movie1.add_actor(Actor("Jack Huang")) assert movie1.actors == [Actor("James Huang"), Actor("Jack Huang")] movie1.add_actor("Ron Huang") movie1.add_actor("") movie1.add_actor(None) movie1.add_actor(21345648) assert movie1.actors == [Actor("James Huang"), Actor("Jack Huang")]
def test_remove_actor(): movie1 = Movie("Spirited Away", 2000) movie1.actors = [Actor("James Huang"), Actor("Ron Huang")] movie1.add_actor(Actor("Jack Huang")) movie1.remove_actor(Actor("Jack Huang")) assert movie1.actors == [Actor("James Huang"), Actor("Ron Huang")] movie1.remove_actor(Actor("James Huang")) movie1.remove_actor(Actor("Jawer")) movie1.remove_actor(Actor("Jackwerang")) movie1.remove_actor(Actor("Jweruang")) assert movie1.actors == [Actor("Ron Huang")] movie1.remove_actor(Actor("Ron Huang")) assert movie1.actors == []