1
+ import pytest
2
+
3
+ from howold import Actor , Movie , get_age
4
+
5
+
6
+ actors = [
7
+ Actor ('Wesley Snipes' , 'July 31, 1962' ),
8
+ Actor ('Robert de Niro' , 'August 17, 1943' ),
9
+ Actor ('Jennifer Aniston' , 'February 11, 1969' ),
10
+ Actor ('Mikey Rourke' , 'September 16, 1952' ),
11
+ Actor ('Al Pacino' , 'July 31, 1962' ),
12
+ Actor ('Alec Baldwin' , 'July 31, 1962' ),
13
+ Actor ('Michelle Pfeiffer' , 'April 29, 1958' ),
14
+ ]
15
+ movies = [
16
+ Movie ('New Jack City' , 'January 17, 1991' ),
17
+ Movie ('Goodfellas' , 'October 19, 1990' ),
18
+ Movie ('Horrible Bosses' , 'September 16, 2011' ),
19
+ Movie ('Harley Davidson and the Marlboro Man' , 'December 28, 1991' ),
20
+ Movie ('Heat' , 'December 15, 1995' ),
21
+ Movie ('Glengarry Glen Ross' , 'September 29, 1992' ),
22
+ Movie ('Scarface' , 'March 12, 1984' ),
23
+ ]
24
+ return_strings = [
25
+ 'Wesley Snipes was 28 years old when New Jack City came out.' ,
26
+ 'Robert de Niro was 47 years old when Goodfellas came out.' ,
27
+ 'Jennifer Aniston was 42 years old when Horrible Bosses came out.' ,
28
+ 'Mikey Rourke was 39 years old when Harley Davidson and the Marlboro Man came out.' , # noqa E501
29
+ 'Al Pacino was 33 years old when Heat came out.' ,
30
+ 'Alec Baldwin was 30 years old when Glengarry Glen Ross came out.' ,
31
+ 'Michelle Pfeiffer was 25 years old when Scarface came out.' ,
32
+ ]
33
+
34
+
35
+ @pytest .mark .parametrize ('actor, movie, expected' ,
36
+ zip (actors , movies , return_strings ))
37
+ def test_get_age (actor , movie , expected ):
38
+ assert get_age (actor , movie ) == expected
0 commit comments