def test_when_passport_is_invalid_when_pid_is_missing(self):
        # given
        passport = """
ecl:gry eyr:2020 hcl:#fffffd
byr:1937 iyr:2017 cid:147 hgt:183cm
        """

        # then
        assert is_passport_valid(passport) is False
    def test_when_passport_is_valid(self):
        # given
        passport = """
ecl:gry pid:860033327 eyr:2020 hcl:#fffffd
byr:1937 iyr:2017 cid:147 hgt:183cm
        """

        # then
        assert is_passport_valid(passport)
    def test_check_pid(self, pid, is_valid):
        # given
        passport = f"""
        pid:{pid} hgt:74in ecl:hzl iyr:2012 eyr:2030 byr:1980
        hcl:#123abc
        """

        # then
        assert is_passport_valid(passport) == is_valid
    def test_when_passport_is_invalid_when_hcl_is_missing(self):
        # given
        passport = """
ecl:gry pid:860033327 eyr:2020
byr:1937 iyr:2017 cid:147 hgt:183cm
        """

        # then
        assert is_passport_valid(passport) is False
    def test_is_invalid_height_when_no_unit(self):
        # given
        passport = """
        pid:087499704 hgt:190 ecl:grn iyr:2012 eyr:2030 byr:1980
        hcl:#623a2f
        """

        # then
        assert is_passport_valid(passport) is False
    def test_check_hair_color(self, color, is_valid):
        # given
        passport = f"""
        pid:087499704 hgt:74in ecl:{color} iyr:2012 eyr:2030 byr:1980
        hcl:#123abc
        """

        # then
        assert is_passport_valid(passport) == is_valid
    def test_190cm_is_valid_height(self):
        # given
        passport = """
        pid:087499704 hgt:190cm ecl:grn iyr:2012 eyr:2030 byr:1980
        hcl:#623a2f
        """

        # then
        assert is_passport_valid(passport)
    def test_when_passport_is_expiring_to_late(self):
        # given
        passport = """
ecl:gry pid:860033327 hcl:#fffffd eyr:2031
byr:1937 iyr:2017 cid:147 hgt:183cm
        """

        # then
        assert is_passport_valid(passport) is False
    def test_when_passport_is_too_young(self):
        # given
        passport = """
    ecl:gry pid:860033327 eyr:2020 hcl:#fffffd
    iyr:2021 cid:147 hgt:183cm byr:2001
            """

        # then
        assert is_passport_valid(passport) is False
    def test_when_passport_a_valid_birthdate(self):
        # given
        passport = """
    ecl:gry pid:860033327 eyr:2020 hcl:#fffffd
    iyr:2010 cid:147 hgt:183cm byr:2001
            """

        # then
        assert is_passport_valid(passport) is True
    def test_when_people_is_too_old(self):
        # given
        passport = """
    ecl:gry pid:860033327 eyr:2020 hcl:#fffffd
    iyr:2017 cid:147 hgt:183cm byr:1919
            """

        # then
        assert is_passport_valid(passport) is False
    def test_is_valid_when_passport_is_from_north_pole_but_containing_every_required_field(
            self):
        # given
        passport = """
hcl:#ae17e1 iyr:2013
eyr:2024
ecl:brn pid:760753108 byr:1931
hgt:179cm
        """

        # then
        assert is_passport_valid(passport) is True
 def test_passport_is_invalid_with_given_example(self, passport):
     assert is_passport_valid(passport) is False