def test_passport_scanner_validate_passport_with_invalid_passport_without_cid_returns_none( ): input = 'hcl:#cfa07d eyr:2025 pid:166559648 iyr:2011 ecl:brn hgt:59in' ps = PassportScanner() result = ps.validate_passport(passport=input) assert result == None
def test_passport_scanner_validate_passport_with_invalid_passport_returns_none( ): input = 'iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884 hcl:#cfa07d byr:1929' ps = PassportScanner() result = ps.validate_passport(passport=input) assert result == None
def test_passport_scanner_validate_passport_without_cid(): input = 'hcl:#ae17e1 iyr:2013 eyr:2024 ecl:brn pid:760753108 byr:1931 hgt:179cm' expected_object = NorthPoleCredential(hcl='#ae17e1', iyr='2013', eyr='2024', ecl='brn', pid='760753108', byr='1931', hgt='179cm') ps = PassportScanner() result = ps.validate_passport(passport=input) assert result == expected_object
def test_passport_scanner_validate_passport_without_newlines(): input = 'ecl:gry pid:860033327 eyr:2020 hcl:#fffffd byr:1937 iyr:2017 cid:147 hgt:183cm' expected_object = NorthPoleCredential(ecl='gry', pid='860033327', eyr='2020', hcl='#fffffd', byr='1937', iyr='2017', cid='147', hgt='183cm') ps = PassportScanner() result = ps.validate_passport(passport=input) assert result == expected_object
def test_passport_scanner_convert_to_dict_with_newlines(): input = 'hcl:#ae17e1 iyr:2013\neyr:2024\necl:brn pid:760753108 byr:1931\nhgt:179cm' ps = PassportScanner() result = ps.convert_to_dict(input=input) assert result == { 'hcl': '#ae17e1', 'iyr': '2013', 'eyr': '2024', 'ecl': 'brn', 'pid': '760753108', 'byr': '1931', 'hgt': '179cm' }
def test_passport_scanner_convert_to_dict_without_newlines(): input = 'ecl:gry pid:860033327 eyr:2020 hcl:#fffffd byr:1937 iyr:2017 cid:147 hgt:183cm' ps = PassportScanner() result = ps.convert_to_dict(input=input) assert result == { 'ecl': 'gry', 'pid': '860033327', 'eyr': '2020', 'hcl': '#fffffd', 'byr': '1937', 'iyr': '2017', 'cid': '147', 'hgt': '183cm' }
def test_passport_scanner_validate_passport_with_additional_validation_returns_none( input): ps = PassportScanner() result = ps.validate_passport(passport=input) assert result == None