def calculator(): print("Social Security Full Retirement Age Calculator"); birth_year_str = str(input("Enter the year of birth or <enter> to exit ")).strip() while birth_year_str != '': birth_year = int(birth_year_str) birth_month = int(input("Enter the month of birth (<Enter> implies 0)")) fra_age_years, fra_age_months = full_retirement_age(birth_year) fra_date_year, fra_date_month = full_retirement_date(birth_year, birth_month) print("your full retirement age is ", fra_age_years, " and ", fra_age_months, " months") print("this will be in ", fra_date_month, " of ", fra_date_year, "\n") birth_year_str = input("Enter the year of birth or <enter> to exit ")
def test_retirement_2(): for birth_year in TEST_RETIREMENT_AGE: actual_year, actual_month = full_retirement_age(birth_year) assert actual_year == TEST_RETIREMENT_AGE[birth_year][TRA_TUPLE_YEAR] and actual_month == \ TEST_RETIREMENT_AGE[birth_year][TRA_TUPLE_MONTH], \ "Failed for birth year {} actual year {} month {}".format(birth_year, actual_year, actual_month)
def test_retirement_1(): year, month = full_retirement_age(CURRENT_YEAR + 1) assert year == -1 and month == -1, "Failed for year {} ".format( CURRENT_YEAR)
def test_retirement_0(): year, month = full_retirement_age(CURRENT_YEAR) assert year == 67 and month == 0, "Failed for year {} ".format( CURRENT_YEAR)