-
Ashwin Maran authoredAshwin Maran authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
practice_test.py 162.16 KiB
#!/usr/bin/python
import os
import json
import math
REL_TOL = 6e-04 # relative tolerance for floats
ABS_TOL = 15e-03 # absolute tolerance for floats
PASS = "PASS"
TEXT_FORMAT = "text" # question type when expected answer is a str, int, float, or bool
# question type when expected answer is a namedtuple
TEXT_FORMAT_NAMEDTUPLE = "text namedtuple"
# question type when the expected answer is a list where the order does *not* matter
TEXT_FORMAT_UNORDERED_LIST = "text list_unordered"
# question type when the expected answer is a list where the order does matter
TEXT_FORMAT_ORDERED_LIST = "text list_ordered"
# question type when the expected answer is a list of namedtuples where the order does matter
TEXT_FORMAT_ORDERED_LIST_NAMEDTUPLE = "text list_ordered namedtuple"
# question type when the expected answer is a list where order does matter, but with possible ties. Elements are ordered according to values in special_ordered_json (with ties allowed)
TEXT_FORMAT_SPECIAL_ORDERED_LIST = "text list_special_ordered"
# question type when the expected answer is a dictionary
TEXT_FORMAT_DICT = "text dict"
# question type when the expected answer is a list of dicts where the order does matter
TEXT_FORMAT_LIST_DICTS_ORDERED = "text list_dicts_ordered"
expected_json = {"1-1": (TEXT_FORMAT, 2015),
"1-2": (TEXT_FORMAT, 43851000),
"1-3": (TEXT_FORMAT, 24),
"1-4": (TEXT_FORMAT, 100),
"1-5": (TEXT_FORMAT, 100),
"1-6": (TEXT_FORMAT, 'CHL'),
"1-7": (TEXT_FORMAT, 'High income'),
"2": (TEXT_FORMAT_DICT, {'Afghanistan': 'AFG',
'Albania': 'ALB',
'Algeria': 'DZA',
'Andorra': 'AND',
'Angola': 'AGO',
'Armenia': 'ARM',
'Australia': 'AUS',
'Austria': 'AUT',
'Azerbaijan': 'AZE',
'Bangladesh': 'BGD',
'Belarus': 'BLR',
'Belgium': 'BEL',
'Belize': 'BLZ',
'Benin': 'BEN',
'Bermuda': 'BMU',
'Bhutan': 'BTN',
'Bosnia and Herzegovina': 'BIH',
'Botswana': 'BWA',
'Brazil': 'BRA',
'Brunei Darussalam': 'BRN',
'Bulgaria': 'BGR',
'Burkina Faso': 'BFA',
'Burundi': 'BDI',
'Cabo Verde': 'CPV',
'Cambodia': 'KHM',
'Cameroon': 'CMR',
'Canada': 'CAN',
'Central African Republic': 'CAF',
'Chad': 'TCD',
'Chile': 'CHL',
'China': 'CHN',
'Colombia': 'COL',
'Costa Rica': 'CRI',
"Côte d'Ivoire": 'CIV',
'Cuba': 'CUB',
'Cyprus': 'CYP',
'Czech Republic': 'CZE',
'Denmark': 'DNK',
'Djibouti': 'DJI',
'Dominican Republic': 'DOM',
'Ecuador': 'ECU',
'El Salvador': 'SLV',
'Estonia': 'EST',
'Eswatini': 'SWZ',
'Ethiopia': 'ETH',
'Fiji': 'FJI',
'Finland': 'FIN',
'France': 'FRA',
'Gabon': 'GAB',
'Georgia': 'GEO',
'Germany': 'DEU',
'Ghana': 'GHA',
'Gibraltar': 'GIB',
'Greece': 'GRC',
'Greenland': 'GRL',
'Guatemala': 'GTM',
'Guinea': 'GIN',
'Guinea-Bissau': 'GNB',
'Guyana': 'GUY',
'Haiti': 'HTI',
'Honduras': 'HND',
'Hungary': 'HUN',
'Iceland': 'ISL',
'India': 'IND',
'Indonesia': 'IDN',
'Iraq': 'IRQ',
'Ireland': 'IRL',
'Israel': 'ISR',
'Jamaica': 'JAM',
'Jordan': 'JOR',
'Kazakhstan': 'KAZ',
'Kenya': 'KEN',
'Kiribati': 'KIR',
'Latvia': 'LVA',
'Lesotho': 'LSO',
'Liberia': 'LBR',
'Lithuania': 'LTU',
'Luxembourg': 'LUX',
'Madagascar': 'MDG',
'Malawi': 'MWI',
'Malaysia': 'MYS',
'Maldives': 'MDV',
'Mali': 'MLI',
'Malta': 'MLT',
'Marshall Islands': 'MHL',
'Mauritania': 'MRT',
'Mauritius': 'MUS',
'Mexico': 'MEX',
'Monaco': 'MCO',
'Mongolia': 'MNG',
'Montenegro': 'MNE',
'Morocco': 'MAR',
'Mozambique': 'MOZ',
'Myanmar': 'MMR',
'Namibia': 'NAM',
'Nauru': 'NRU',
'Nepal': 'NPL',
'Netherlands': 'NLD',
'New Zealand': 'NZL',
'Nicaragua': 'NIC',
'Niger': 'NER',
'Nigeria': 'NGA',
'North Macedonia': 'MKD',
'Norway': 'NOR',
'Oman': 'OMN',
'Pakistan': 'PAK',
'Palau': 'PLW',
'Panama': 'PAN',
'Papua New Guinea': 'PNG',
'Paraguay': 'PRY',
'Peru': 'PER',
'Philippines': 'PHL',
'Poland': 'POL',
'Portugal': 'PRT',
'Romania': 'ROU',
'Russian Federation': 'RUS',
'Rwanda': 'RWA',
'Samoa': 'WSM',
'Senegal': 'SEN',
'Serbia': 'SRB',
'Sierra Leone': 'SLE',
'Singapore': 'SGP',
'Solomon Islands': 'SLB',
'Somalia': 'SOM',
'South Africa': 'ZAF',
'South Sudan': 'SSD',
'Spain': 'ESP',
'Sri Lanka': 'LKA',
'Sudan': 'SDN',
'Suriname': 'SUR',
'Sweden': 'SWE',
'Switzerland': 'CHE',
'Syrian Arab Republic': 'SYR',
'Tajikistan': 'TJK',
'Thailand': 'THA',
'Timor-Leste': 'TLS',
'Togo': 'TGO',
'Tonga': 'TON',
'Tunisia': 'TUN',
'Turkmenistan': 'TKM',
'Tuvalu': 'TUV',
'Uganda': 'UGA',
'Ukraine': 'UKR',
'United Kingdom': 'GBR',
'United States of America': 'USA',
'Uruguay': 'URY',
'Uzbekistan': 'UZB',
'Vanuatu': 'VUT',
'Vietnam': 'VNM',
'Zambia': 'ZMB',
'Zimbabwe': 'ZWE'}),
"3-1": (TEXT_FORMAT, 'IRL'),
"3-2": (TEXT_FORMAT, 'SDN'),
"4": (TEXT_FORMAT_DICT, {'Afghanistan': 'Low income',
'Albania': 'Upper middle income',
'Algeria': 'Upper middle income',
'Andorra': 'High income',
'Angola': 'Upper middle income',
'Armenia': 'Lower middle income',
'Australia': 'High income',
'Austria': 'High income',
'Azerbaijan': 'Upper middle income',
'Bangladesh': 'Lower middle income',
'Belarus': 'Upper middle income',
'Belgium': 'High income',
'Belize': 'Upper middle income',
'Benin': 'Low income',
'Bermuda': 'High income',
'Bhutan': 'Lower middle income',
'Bosnia and Herzegovina': 'Upper middle income',
'Botswana': 'Upper middle income',
'Brazil': 'Upper middle income',
'Brunei Darussalam': 'High income',
'Bulgaria': 'Upper middle income',
'Burkina Faso': 'Low income',
'Burundi': 'Low income',
'Cabo Verde': 'Lower middle income',
'Cambodia': 'Lower middle income',
'Cameroon': 'Lower middle income',
'Canada': 'High income',
'Central African Republic': 'Low income',
'Chad': 'Low income',
'Chile': 'High income',
'China': 'Upper middle income',
'Colombia': 'Upper middle income',
'Costa Rica': 'Upper middle income',
"Côte d'Ivoire": 'Lower middle income',
'Cuba': 'Upper middle income',
'Cyprus': 'High income',
'Czech Republic': 'High income',
'Denmark': 'High income',
'Djibouti': 'Lower middle income',
'Dominican Republic': 'Upper middle income',
'Ecuador': 'Upper middle income',
'El Salvador': 'Lower middle income',
'Estonia': 'High income',
'Eswatini': 'Lower middle income',
'Ethiopia': 'Low income',
'Fiji': 'Upper middle income',
'Finland': 'High income',
'France': 'High income',
'Gabon': 'Upper middle income',
'Georgia': 'Upper middle income',
'Germany': 'High income',
'Ghana': 'Lower middle income',
'Gibraltar': 'High income',
'Greece': 'High income',
'Greenland': 'High income',
'Guatemala': 'Lower middle income',
'Guinea': 'Low income',
'Guinea-Bissau': 'Low income',
'Guyana': 'Upper middle income',
'Haiti': 'Low income',
'Honduras': 'Lower middle income',
'Hungary': 'High income',
'Iceland': 'High income',
'India': 'Lower middle income',
'Indonesia': 'Lower middle income',
'Iraq': 'Upper middle income',
'Ireland': 'High income',
'Israel': 'High income',
'Jamaica': 'Upper middle income',
'Jordan': 'Upper middle income',
'Kazakhstan': 'Upper middle income',
'Kenya': 'Lower middle income',
'Kiribati': 'Lower middle income',
'Latvia': 'High income',
'Lesotho': 'Lower middle income',
'Liberia': 'Low income',
'Lithuania': 'High income',
'Luxembourg': 'High income',
'Madagascar': 'Low income',
'Malawi': 'Low income',
'Malaysia': 'Upper middle income',
'Maldives': 'Upper middle income',
'Mali': 'Low income',
'Malta': 'High income',
'Marshall Islands': 'Upper middle income',
'Mauritania': 'Lower middle income',
'Mauritius': 'Upper middle income',
'Mexico': 'Upper middle income',
'Monaco': 'High income',
'Mongolia': 'Lower middle income',
'Montenegro': 'Upper middle income',
'Morocco': 'Lower middle income',
'Mozambique': 'Low income',
'Myanmar': 'Lower middle income',
'Namibia': 'Upper middle income',
'Nauru': 'High income',
'Nepal': 'Low income',
'Netherlands': 'High income',
'New Zealand': 'High income',
'Nicaragua': 'Lower middle income',
'Niger': 'Low income',
'Nigeria': 'Lower middle income',
'North Macedonia': 'Upper middle income',
'Norway': 'High income',
'Oman': 'High income',
'Pakistan': 'Lower middle income',
'Palau': 'Upper middle income',
'Panama': 'Upper middle income',
'Papua New Guinea': 'Lower middle income',
'Paraguay': 'Upper middle income',
'Peru': 'Upper middle income',
'Philippines': 'Lower middle income',
'Poland': 'High income',
'Portugal': 'High income',
'Romania': 'Upper middle income',
'Russian Federation': 'Upper middle income',
'Rwanda': 'Low income',
'Samoa': 'Lower middle income',
'Senegal': 'Low income',
'Serbia': 'Upper middle income',
'Sierra Leone': 'Low income',
'Singapore': 'High income',
'Solomon Islands': 'Lower middle income',
'Somalia': 'Low income',
'South Africa': 'Upper middle income',
'South Sudan': 'Low income',
'Spain': 'High income',
'Sri Lanka': 'Lower middle income',
'Sudan': 'Lower middle income',
'Suriname': 'Upper middle income',
'Sweden': 'High income',
'Switzerland': 'High income',
'Syrian Arab Republic': 'Lower middle income',
'Tajikistan': 'Lower middle income',
'Thailand': 'Upper middle income',
'Timor-Leste': 'Lower middle income',
'Togo': 'Low income',
'Tonga': 'Lower middle income',
'Tunisia': 'Lower middle income',
'Turkmenistan': 'Upper middle income',
'Tuvalu': 'Upper middle income',
'Uganda': 'Low income',
'Ukraine': 'Lower middle income',
'United Kingdom': 'High income',
'United States of America': 'High income',
'Uruguay': 'High income',
'Uzbekistan': 'Lower middle income',
'Vanuatu': 'Lower middle income',
'Vietnam': 'Lower middle income',
'Zambia': 'Lower middle income',
'Zimbabwe': 'Low income'}),
"5": (TEXT_FORMAT_DICT, {'Afghanistan': 'Low income',
'Albania': 'Upper middle income',
'Algeria': 'Lower middle income',
'Andorra': 'High income',
'Angola': 'Lower middle income',
'Armenia': 'Upper middle income',
'Australia': 'High income',
'Austria': 'High income',
'Azerbaijan': 'Upper middle income',
'Bangladesh': 'Lower middle income',
'Belarus': 'Upper middle income',
'Belgium': 'High income',
'Belize': 'Lower middle income',
'Benin': 'Lower middle income',
'Bermuda': 'High income',
'Bhutan': 'Lower middle income',
'Bosnia and Herzegovina': 'Upper middle income',
'Botswana': 'Upper middle income',
'Brazil': 'Upper middle income',
'Brunei Darussalam': 'High income',
'Bulgaria': 'Upper middle income',
'Burkina Faso': 'Low income',
'Burundi': 'Low income',
'Cabo Verde': 'Lower middle income',
'Cambodia': 'Lower middle income',
'Cameroon': 'Lower middle income',
'Canada': 'High income',
'Central African Republic': 'Low income',
'Chad': 'Low income',
'Chile': 'High income',
'China': 'Upper middle income',
'Colombia': 'Upper middle income',
'Costa Rica': 'Upper middle income',
"Côte d'Ivoire": 'Lower middle income',
'Cuba': 'Upper middle income',
'Cyprus': 'High income',
'Czech Republic': 'High income',
'Denmark': 'High income',
'Djibouti': 'Lower middle income',
'Dominican Republic': 'Upper middle income',
'Ecuador': 'Upper middle income',
'El Salvador': 'Lower middle income',
'Estonia': 'High income',
'Eswatini': 'Lower middle income',
'Ethiopia': 'Low income',
'Fiji': 'Upper middle income',
'Finland': 'High income',
'France': 'High income',
'Gabon': 'Upper middle income',
'Georgia': 'Upper middle income',
'Germany': 'High income',
'Ghana': 'Lower middle income',
'Gibraltar': 'High income',
'Greece': 'High income',
'Greenland': 'High income',
'Guatemala': 'Upper middle income',
'Guinea': 'Low income',
'Guinea-Bissau': 'Low income',
'Guyana': 'Upper middle income',
'Haiti': 'Lower middle income',
'Honduras': 'Lower middle income',
'Hungary': 'High income',
'Iceland': 'High income',
'India': 'Lower middle income',
'Indonesia': 'Lower middle income',
'Iraq': 'Upper middle income',
'Ireland': 'High income',
'Israel': 'High income',
'Jamaica': 'Upper middle income',
'Jordan': 'Upper middle income',
'Kazakhstan': 'Upper middle income',
'Kenya': 'Lower middle income',
'Kiribati': 'Lower middle income',
'Latvia': 'High income',
'Lesotho': 'Lower middle income',
'Liberia': 'Low income',
'Lithuania': 'High income',
'Luxembourg': 'High income',
'Madagascar': 'Low income',
'Malawi': 'Low income',
'Malaysia': 'Upper middle income',
'Maldives': 'Upper middle income',
'Mali': 'Low income',
'Malta': 'High income',
'Marshall Islands': 'Upper middle income',
'Mauritania': 'Lower middle income',
'Mauritius': 'Upper middle income',
'Mexico': 'Upper middle income',
'Monaco': 'High income',
'Mongolia': 'Lower middle income',
'Montenegro': 'Upper middle income',
'Morocco': 'Lower middle income',
'Mozambique': 'Low income',
'Myanmar': 'Lower middle income',
'Namibia': 'Upper middle income',
'Nauru': 'High income',
'Nepal': 'Lower middle income',
'Netherlands': 'High income',
'New Zealand': 'High income',
'Nicaragua': 'Lower middle income',
'Niger': 'Low income',
'Nigeria': 'Lower middle income',
'North Macedonia': 'Upper middle income',
'Norway': 'High income',
'Oman': 'High income',
'Pakistan': 'Lower middle income',
'Palau': 'High income',
'Panama': 'Upper middle income',
'Papua New Guinea': 'Lower middle income',
'Paraguay': 'Upper middle income',
'Peru': 'Upper middle income',
'Philippines': 'Lower middle income',
'Poland': 'High income',
'Portugal': 'High income',
'Romania': 'Upper middle income',
'Russian Federation': 'Upper middle income',
'Rwanda': 'Low income',
'Samoa': 'Lower middle income',
'Senegal': 'Lower middle income',
'Serbia': 'Upper middle income',
'Sierra Leone': 'Low income',
'Singapore': 'High income',
'Solomon Islands': 'Lower middle income',
'Somalia': 'Low income',
'South Africa': 'Upper middle income',
'South Sudan': 'Low income',
'Spain': 'High income',
'Sri Lanka': 'Lower middle income',
'Sudan': 'Low income',
'Suriname': 'Upper middle income',
'Sweden': 'High income',
'Switzerland': 'High income',
'Syrian Arab Republic': 'Low income',
'Tajikistan': 'Lower middle income',
'Thailand': 'Upper middle income',
'Timor-Leste': 'Lower middle income',
'Togo': 'Low income',
'Tonga': 'Upper middle income',
'Tunisia': 'Lower middle income',
'Turkmenistan': 'Upper middle income',
'Tuvalu': 'Upper middle income',
'Uganda': 'Low income',
'Ukraine': 'Lower middle income',
'United Kingdom': 'High income',
'United States of America': 'High income',
'Uruguay': 'High income',
'Uzbekistan': 'Lower middle income',
'Vanuatu': 'Lower middle income',
'Vietnam': 'Lower middle income',
'Zambia': 'Lower middle income',
'Zimbabwe': 'Lower middle income'}),
"6-1": (TEXT_FORMAT, 'Low income'),
"6-2": (TEXT_FORMAT, 'Lower middle income'),
"7": (TEXT_FORMAT_UNORDERED_LIST, ['Albania',
'Andorra',
'Bermuda',
'Bosnia and Herzegovina',
'Bulgaria',
'Georgia',
'Greece',
'Hungary',
'Latvia',
'Lithuania',
'Poland',
'Portugal',
'Romania',
'Serbia',
'Syrian Arab Republic',
'Ukraine']),
"8": (TEXT_FORMAT_UNORDERED_LIST, ['Afghanistan',
'Albania',
'Algeria',
'Angola',
'Austria',
'Azerbaijan',
'Bangladesh',
'Belarus',
'Belize',
'Benin',
'Bhutan',
'Bosnia and Herzegovina',
'Botswana',
'Brazil',
'Brunei Darussalam',
'Bulgaria',
'Burkina Faso',
'Burundi',
'Cabo Verde',
'Cambodia',
'Cameroon',
'Canada',
'Central African Republic',
'Chad',
'Chile',
'China',
'Colombia',
'Costa Rica',
"Côte d'Ivoire",
'Czech Republic',
'Djibouti',
'Dominican Republic',
'Ecuador',
'El Salvador',
'Estonia',
'Eswatini',
'Ethiopia',
'Fiji',
'Finland',
'France',
'Gabon',
'Georgia',
'Ghana',
'Greece',
'Greenland',
'Guatemala',
'Guinea',
'Guinea-Bissau',
'Guyana',
'Haiti',
'Honduras',
'Hungary',
'India',
'Indonesia',
'Iraq',
'Ireland',
'Israel',
'Jamaica',
'Jordan',
'Kazakhstan',
'Kenya',
'Kiribati',
'Lesotho',
'Liberia',
'Lithuania',
'Luxembourg',
'Madagascar',
'Malawi',
'Malaysia',
'Maldives',
'Mali',
'Malta',
'Marshall Islands',
'Mauritania',
'Mexico',
'Mongolia',
'Montenegro',
'Morocco',
'Mozambique',
'Myanmar',
'Namibia',
'Nepal',
'Netherlands',
'New Zealand',
'Nicaragua',
'Niger',
'Nigeria',
'North Macedonia',
'Norway',
'Oman',
'Pakistan',
'Palau',
'Panama',
'Paraguay',
'Peru',
'Philippines',
'Portugal',
'Russian Federation',
'Senegal',
'Sierra Leone',
'Solomon Islands',
'Somalia',
'South Africa',
'South Sudan',
'Spain',
'Sri Lanka',
'Sudan',
'Sweden',
'Syrian Arab Republic',
'Tajikistan',
'Thailand',
'Timor-Leste',
'Togo',
'Tunisia',
'Turkmenistan',
'Tuvalu',
'Uganda',
'United Kingdom',
'United States of America',
'Uruguay',
'Vanuatu',
'Vietnam',
'Zambia']),
"9": (TEXT_FORMAT_DICT, {'Afghanistan': {2015: 'Low income', 2020: 'Low income'},
'Albania': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Algeria': {2015: 'Upper middle income', 2020: 'Lower middle income'},
'Andorra': {2015: 'High income', 2020: 'High income'},
'Angola': {2015: 'Upper middle income', 2020: 'Lower middle income'},
'Armenia': {2015: 'Lower middle income', 2020: 'Upper middle income'},
'Australia': {2015: 'High income', 2020: 'High income'},
'Austria': {2015: 'High income', 2020: 'High income'},
'Azerbaijan': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Bangladesh': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Belarus': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Belgium': {2015: 'High income', 2020: 'High income'},
'Belize': {2015: 'Upper middle income', 2020: 'Lower middle income'},
'Benin': {2015: 'Low income', 2020: 'Lower middle income'},
'Bermuda': {2015: 'High income', 2020: 'High income'},
'Bhutan': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Bosnia and Herzegovina': {2015: 'Upper middle income',
2020: 'Upper middle income'},
'Botswana': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Brazil': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Brunei Darussalam': {2015: 'High income', 2020: 'High income'},
'Bulgaria': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Burkina Faso': {2015: 'Low income', 2020: 'Low income'},
'Burundi': {2015: 'Low income', 2020: 'Low income'},
'Cabo Verde': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Cambodia': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Cameroon': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Canada': {2015: 'High income', 2020: 'High income'},
'Central African Republic': {2015: 'Low income', 2020: 'Low income'},
'Chad': {2015: 'Low income', 2020: 'Low income'},
'Chile': {2015: 'High income', 2020: 'High income'},
'China': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Colombia': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Costa Rica': {2015: 'Upper middle income', 2020: 'Upper middle income'},
"Côte d'Ivoire": {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Cuba': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Cyprus': {2015: 'High income', 2020: 'High income'},
'Czech Republic': {2015: 'High income', 2020: 'High income'},
'Denmark': {2015: 'High income', 2020: 'High income'},
'Djibouti': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Dominican Republic': {2015: 'Upper middle income',
2020: 'Upper middle income'},
'Ecuador': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'El Salvador': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Estonia': {2015: 'High income', 2020: 'High income'},
'Eswatini': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Ethiopia': {2015: 'Low income', 2020: 'Low income'},
'Fiji': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Finland': {2015: 'High income', 2020: 'High income'},
'France': {2015: 'High income', 2020: 'High income'},
'Gabon': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Georgia': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Germany': {2015: 'High income', 2020: 'High income'},
'Ghana': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Gibraltar': {2015: 'High income', 2020: 'High income'},
'Greece': {2015: 'High income', 2020: 'High income'},
'Greenland': {2015: 'High income', 2020: 'High income'},
'Guatemala': {2015: 'Lower middle income', 2020: 'Upper middle income'},
'Guinea': {2015: 'Low income', 2020: 'Low income'},
'Guinea-Bissau': {2015: 'Low income', 2020: 'Low income'},
'Guyana': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Haiti': {2015: 'Low income', 2020: 'Lower middle income'},
'Honduras': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Hungary': {2015: 'High income', 2020: 'High income'},
'Iceland': {2015: 'High income', 2020: 'High income'},
'India': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Indonesia': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Iraq': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Ireland': {2015: 'High income', 2020: 'High income'},
'Israel': {2015: 'High income', 2020: 'High income'},
'Jamaica': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Jordan': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Kazakhstan': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Kenya': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Kiribati': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Latvia': {2015: 'High income', 2020: 'High income'},
'Lesotho': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Liberia': {2015: 'Low income', 2020: 'Low income'},
'Lithuania': {2015: 'High income', 2020: 'High income'},
'Luxembourg': {2015: 'High income', 2020: 'High income'},
'Madagascar': {2015: 'Low income', 2020: 'Low income'},
'Malawi': {2015: 'Low income', 2020: 'Low income'},
'Malaysia': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Maldives': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Mali': {2015: 'Low income', 2020: 'Low income'},
'Malta': {2015: 'High income', 2020: 'High income'},
'Marshall Islands': {2015: 'Upper middle income',
2020: 'Upper middle income'},
'Mauritania': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Mauritius': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Mexico': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Monaco': {2015: 'High income', 2020: 'High income'},
'Mongolia': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Montenegro': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Morocco': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Mozambique': {2015: 'Low income', 2020: 'Low income'},
'Myanmar': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Namibia': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Nauru': {2015: 'High income', 2020: 'High income'},
'Nepal': {2015: 'Low income', 2020: 'Lower middle income'},
'Netherlands': {2015: 'High income', 2020: 'High income'},
'New Zealand': {2015: 'High income', 2020: 'High income'},
'Nicaragua': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Niger': {2015: 'Low income', 2020: 'Low income'},
'Nigeria': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'North Macedonia': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Norway': {2015: 'High income', 2020: 'High income'},
'Oman': {2015: 'High income', 2020: 'High income'},
'Pakistan': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Palau': {2015: 'Upper middle income', 2020: 'High income'},
'Panama': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Papua New Guinea': {2015: 'Lower middle income',
2020: 'Lower middle income'},
'Paraguay': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Peru': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Philippines': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Poland': {2015: 'High income', 2020: 'High income'},
'Portugal': {2015: 'High income', 2020: 'High income'},
'Romania': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Russian Federation': {2015: 'Upper middle income',
2020: 'Upper middle income'},
'Rwanda': {2015: 'Low income', 2020: 'Low income'},
'Samoa': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Senegal': {2015: 'Low income', 2020: 'Lower middle income'},
'Serbia': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Sierra Leone': {2015: 'Low income', 2020: 'Low income'},
'Singapore': {2015: 'High income', 2020: 'High income'},
'Solomon Islands': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Somalia': {2015: 'Low income', 2020: 'Low income'},
'South Africa': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'South Sudan': {2015: 'Low income', 2020: 'Low income'},
'Spain': {2015: 'High income', 2020: 'High income'},
'Sri Lanka': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Sudan': {2015: 'Lower middle income', 2020: 'Low income'},
'Suriname': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Sweden': {2015: 'High income', 2020: 'High income'},
'Switzerland': {2015: 'High income', 2020: 'High income'},
'Syrian Arab Republic': {2015: 'Lower middle income', 2020: 'Low income'},
'Tajikistan': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Thailand': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Timor-Leste': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Togo': {2015: 'Low income', 2020: 'Low income'},
'Tonga': {2015: 'Lower middle income', 2020: 'Upper middle income'},
'Tunisia': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Turkmenistan': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Tuvalu': {2015: 'Upper middle income', 2020: 'Upper middle income'},
'Uganda': {2015: 'Low income', 2020: 'Low income'},
'Ukraine': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'United Kingdom': {2015: 'High income', 2020: 'High income'},
'United States of America': {2015: 'High income', 2020: 'High income'},
'Uruguay': {2015: 'High income', 2020: 'High income'},
'Uzbekistan': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Vanuatu': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Vietnam': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Zambia': {2015: 'Lower middle income', 2020: 'Lower middle income'},
'Zimbabwe': {2015: 'Low income', 2020: 'Lower middle income'}}),
"10-1": (TEXT_FORMAT, 'Upper middle income'),
"10-2": (TEXT_FORMAT, 'High income'),
"11": (TEXT_FORMAT_DICT, {'Afghanistan': False,
'Albania': False,
'Algeria': True,
'Andorra': False,
'Angola': True,
'Armenia': True,
'Australia': False,
'Austria': False,
'Azerbaijan': False,
'Bangladesh': False,
'Belarus': False,
'Belgium': False,
'Belize': True,
'Benin': True,
'Bermuda': False,
'Bhutan': False,
'Bosnia and Herzegovina': False,
'Botswana': False,
'Brazil': False,
'Brunei Darussalam': False,
'Bulgaria': False,
'Burkina Faso': False,
'Burundi': False,
'Cabo Verde': False,
'Cambodia': False,
'Cameroon': False,
'Canada': False,
'Central African Republic': False,
'Chad': False,
'Chile': False,
'China': False,
'Colombia': False,
'Costa Rica': False,
"Côte d'Ivoire": False,
'Cuba': False,
'Cyprus': False,
'Czech Republic': False,
'Denmark': False,
'Djibouti': False,
'Dominican Republic': False,
'Ecuador': False,
'El Salvador': False,
'Estonia': False,
'Eswatini': False,
'Ethiopia': False,
'Fiji': False,
'Finland': False,
'France': False,
'Gabon': False,
'Georgia': False,
'Germany': False,
'Ghana': False,
'Gibraltar': False,
'Greece': False,
'Greenland': False,
'Guatemala': True,
'Guinea': False,
'Guinea-Bissau': False,
'Guyana': False,
'Haiti': True,
'Honduras': False,
'Hungary': False,
'Iceland': False,
'India': False,
'Indonesia': False,
'Iraq': False,
'Ireland': False,
'Israel': False,
'Jamaica': False,
'Jordan': False,
'Kazakhstan': False,
'Kenya': False,
'Kiribati': False,
'Latvia': False,
'Lesotho': False,
'Liberia': False,
'Lithuania': False,
'Luxembourg': False,
'Madagascar': False,
'Malawi': False,
'Malaysia': False,
'Maldives': False,
'Mali': False,
'Malta': False,
'Marshall Islands': False,
'Mauritania': False,
'Mauritius': False,
'Mexico': False,
'Monaco': False,
'Mongolia': False,
'Montenegro': False,
'Morocco': False,
'Mozambique': False,
'Myanmar': False,
'Namibia': False,
'Nauru': False,
'Nepal': True,
'Netherlands': False,
'New Zealand': False,
'Nicaragua': False,
'Niger': False,
'Nigeria': False,
'North Macedonia': False,
'Norway': False,
'Oman': False,
'Pakistan': False,
'Palau': True,
'Panama': False,
'Papua New Guinea': False,
'Paraguay': False,
'Peru': False,
'Philippines': False,
'Poland': False,
'Portugal': False,
'Romania': False,
'Russian Federation': False,
'Rwanda': False,
'Samoa': False,
'Senegal': True,
'Serbia': False,
'Sierra Leone': False,
'Singapore': False,
'Solomon Islands': False,
'Somalia': False,
'South Africa': False,
'South Sudan': False,
'Spain': False,
'Sri Lanka': False,
'Sudan': True,
'Suriname': False,
'Sweden': False,
'Switzerland': False,
'Syrian Arab Republic': True,
'Tajikistan': False,
'Thailand': False,
'Timor-Leste': False,
'Togo': False,
'Tonga': True,
'Tunisia': False,
'Turkmenistan': False,
'Tuvalu': False,
'Uganda': False,
'Ukraine': False,
'United Kingdom': False,
'United States of America': False,
'Uruguay': False,
'Uzbekistan': False,
'Vanuatu': False,
'Vietnam': False,
'Zambia': False,
'Zimbabwe': True}),
"12": (TEXT_FORMAT_DICT, {'Low income': ['Afghanistan',
'Benin',
'Burkina Faso',
'Burundi',
'Central African Republic',
'Chad',
'Ethiopia',
'Guinea',
'Guinea-Bissau',
'Haiti',
'Liberia',
'Madagascar',
'Malawi',
'Mali',
'Mozambique',
'Nepal',
'Niger',
'Rwanda',
'Senegal',
'Sierra Leone',
'Somalia',
'South Sudan',
'Togo',
'Uganda',
'Zimbabwe'],
'Upper middle income': ['Albania',
'Algeria',
'Angola',
'Azerbaijan',
'Belarus',
'Belize',
'Bosnia and Herzegovina',
'Botswana',
'Brazil',
'Bulgaria',
'China',
'Colombia',
'Costa Rica',
'Cuba',
'Dominican Republic',
'Ecuador',
'Fiji',
'Gabon',
'Georgia',
'Guyana',
'Iraq',
'Jamaica',
'Jordan',
'Kazakhstan',
'Malaysia',
'Maldives',
'Marshall Islands',
'Mauritius',
'Mexico',
'Montenegro',
'Namibia',
'North Macedonia',
'Palau',
'Panama',
'Paraguay',
'Peru',
'Romania',
'Russian Federation',
'Serbia',
'South Africa',
'Suriname',
'Thailand',
'Turkmenistan',
'Tuvalu'],
'High income': ['Andorra',
'Australia',
'Austria',
'Belgium',
'Bermuda',
'Brunei Darussalam',
'Canada',
'Chile',
'Cyprus',
'Czech Republic',
'Denmark',
'Estonia',
'Finland',
'France',
'Germany',
'Gibraltar',
'Greece',
'Greenland',
'Hungary',
'Iceland',
'Ireland',
'Israel',
'Latvia',
'Lithuania',
'Luxembourg',
'Malta',
'Monaco',
'Nauru',
'Netherlands',
'New Zealand',
'Norway',
'Oman',
'Poland',
'Portugal',
'Singapore',
'Spain',
'Sweden',
'Switzerland',
'United Kingdom',
'United States of America',
'Uruguay'],
'Lower middle income': ['Armenia',
'Bangladesh',
'Bhutan',
'Cabo Verde',
'Cambodia',
'Cameroon',
"Côte d'Ivoire",
'Djibouti',
'El Salvador',
'Eswatini',
'Ghana',
'Guatemala',
'Honduras',
'India',
'Indonesia',
'Kenya',
'Kiribati',
'Lesotho',
'Mauritania',
'Mongolia',
'Morocco',
'Myanmar',
'Nicaragua',
'Nigeria',
'Pakistan',
'Papua New Guinea',
'Philippines',
'Samoa',
'Solomon Islands',
'Sri Lanka',
'Sudan',
'Syrian Arab Republic',
'Tajikistan',
'Timor-Leste',
'Tonga',
'Tunisia',
'Ukraine',
'Uzbekistan',
'Vanuatu',
'Vietnam',
'Zambia']}),
"13": (TEXT_FORMAT_DICT, {'Low income': ['Afghanistan',
'Burkina Faso',
'Burundi',
'Central African Republic',
'Chad',
'Ethiopia',
'Guinea',
'Guinea-Bissau',
'Liberia',
'Madagascar',
'Malawi',
'Mali',
'Mozambique',
'Niger',
'Rwanda',
'Sierra Leone',
'Somalia',
'South Sudan',
'Sudan',
'Syrian Arab Republic',
'Togo',
'Uganda'],
'Upper middle income': ['Albania',
'Armenia',
'Azerbaijan',
'Belarus',
'Bosnia and Herzegovina',
'Botswana',
'Brazil',
'Bulgaria',
'China',
'Colombia',
'Costa Rica',
'Cuba',
'Dominican Republic',
'Ecuador',
'Fiji',
'Gabon',
'Georgia',
'Guatemala',
'Guyana',
'Iraq',
'Jamaica',
'Jordan',
'Kazakhstan',
'Malaysia',
'Maldives',
'Marshall Islands',
'Mauritius',
'Mexico',
'Montenegro',
'Namibia',
'North Macedonia',
'Panama',
'Paraguay',
'Peru',
'Romania',
'Russian Federation',
'Serbia',
'South Africa',
'Suriname',
'Thailand',
'Tonga',
'Turkmenistan',
'Tuvalu'],
'Lower middle income': ['Algeria',
'Angola',
'Bangladesh',
'Belize',
'Benin',
'Bhutan',
'Cabo Verde',
'Cambodia',
'Cameroon',
"Côte d'Ivoire",
'Djibouti',
'El Salvador',
'Eswatini',
'Ghana',
'Haiti',
'Honduras',
'India',
'Indonesia',
'Kenya',
'Kiribati',
'Lesotho',
'Mauritania',
'Mongolia',
'Morocco',
'Myanmar',
'Nepal',
'Nicaragua',
'Nigeria',
'Pakistan',
'Papua New Guinea',
'Philippines',
'Samoa',
'Senegal',
'Solomon Islands',
'Sri Lanka',
'Tajikistan',
'Timor-Leste',
'Tunisia',
'Ukraine',
'Uzbekistan',
'Vanuatu',
'Vietnam',
'Zambia',
'Zimbabwe'],
'High income': ['Andorra',
'Australia',
'Austria',
'Belgium',
'Bermuda',
'Brunei Darussalam',
'Canada',
'Chile',
'Cyprus',
'Czech Republic',
'Denmark',
'Estonia',
'Finland',
'France',
'Germany',
'Gibraltar',
'Greece',
'Greenland',
'Hungary',
'Iceland',
'Ireland',
'Israel',
'Latvia',
'Lithuania',
'Luxembourg',
'Malta',
'Monaco',
'Nauru',
'Netherlands',
'New Zealand',
'Norway',
'Oman',
'Palau',
'Poland',
'Portugal',
'Singapore',
'Spain',
'Sweden',
'Switzerland',
'United Kingdom',
'United States of America',
'Uruguay']}),
"14-1": (TEXT_FORMAT_DICT, {'Low income': 25,
'Upper middle income': 44,
'High income': 41,
'Lower middle income': 41}),
"14-2": (TEXT_FORMAT_DICT, {'Low income': 22,
'Upper middle income': 43,
'Lower middle income': 44,
'High income': 42}),
"15-1": (TEXT_FORMAT_DICT, {'Afghanistan': 38928000,
'Albania': 2878000,
'Algeria': 43851000,
'Andorra': 77000,
'Angola': 32866000,
'Armenia': 2963000,
'Australia': 25500000,
'Austria': 9006000,
'Azerbaijan': 10139000,
'Bangladesh': 164689000,
'Belarus': 9449000,
'Belgium': 11590000,
'Belize': 398000,
'Benin': 12123000,
'Bermuda': 62000,
'Bhutan': 772000,
'Bosnia and Herzegovina': 3281000,
'Botswana': 2352000,
'Brazil': 212559000,
'Brunei Darussalam': 437000,
'Bulgaria': 6948000,
'Burkina Faso': 20903000,
'Burundi': 11891000,
'Cabo Verde': 556000,
'Cambodia': 16719000,
'Cameroon': 26546000,
'Canada': 37742000,
'Central African Republic': 4830000,
'Chad': 16426000,
'Chile': 19116000,
'China': 1463141000,
'Colombia': 50883000,
'Costa Rica': 5094000,
"Côte d'Ivoire": 26378000,
'Cuba': 11327000,
'Cyprus': 1207000,
'Czech Republic': 10709000,
'Denmark': 5792000,
'Djibouti': 988000,
'Dominican Republic': 10848000,
'Ecuador': 17643000,
'El Salvador': 6486000,
'Estonia': 1327000,
'Eswatini': 1160000,
'Ethiopia': 114964000,
'Fiji': 896000,
'Finland': 5541000,
'France': 65274000,
'Gabon': 2226000,
'Georgia': 3989000,
'Germany': 83784000,
'Ghana': 31073000,
'Gibraltar': 34000,
'Greece': 10423000,
'Greenland': 57000,
'Guatemala': 17916000,
'Guinea': 13133000,
'Guinea-Bissau': 1968000,
'Guyana': 787000,
'Haiti': 11403000,
'Honduras': 9905000,
'Hungary': 9660000,
'Iceland': 341000,
'India': 1380004000,
'Indonesia': 273524000,
'Iraq': 40223000,
'Ireland': 4938000,
'Israel': 8656000,
'Jamaica': 2961000,
'Jordan': 10203000,
'Kazakhstan': 18777000,
'Kenya': 53771000,
'Kiribati': 119000,
'Latvia': 1886000,
'Lesotho': 2142000,
'Liberia': 5058000,
'Lithuania': 2722000,
'Luxembourg': 626000,
'Madagascar': 27691000,
'Malawi': 19130000,
'Malaysia': 32366000,
'Maldives': 541000,
'Mali': 20251000,
'Malta': 442000,
'Marshall Islands': 59000,
'Mauritania': 4650000,
'Mauritius': 1272000,
'Mexico': 128933000,
'Monaco': 39000,
'Mongolia': 3278000,
'Montenegro': 628000,
'Morocco': 36911000,
'Mozambique': 31255000,
'Myanmar': 54410000,
'Namibia': 2541000,
'Nauru': 11000,
'Nepal': 29137000,
'Netherlands': 17135000,
'New Zealand': 4822000,
'Nicaragua': 6625000,
'Niger': 24207000,
'Nigeria': 206140000,
'North Macedonia': 2083000,
'Norway': 5421000,
'Oman': 5107000,
'Pakistan': 220892000,
'Palau': 18000,
'Panama': 4315000,
'Papua New Guinea': 8947000,
'Paraguay': 7133000,
'Peru': 32972000,
'Philippines': 109581000,
'Poland': 37847000,
'Portugal': 10197000,
'Romania': 19238000,
'Russian Federation': 145934000,
'Rwanda': 12952000,
'Samoa': 198000,
'Senegal': 16744000,
'Serbia': 8737000,
'Sierra Leone': 7977000,
'Singapore': 5850000,
'Solomon Islands': 687000,
'Somalia': 15893000,
'South Africa': 59309000,
'South Sudan': 11194000,
'Spain': 46755000,
'Sri Lanka': 21413000,
'Sudan': 43849000,
'Suriname': 587000,
'Sweden': 10099000,
'Switzerland': 8655000,
'Syrian Arab Republic': 17501000,
'Tajikistan': 9538000,
'Thailand': 69800000,
'Timor-Leste': 1318000,
'Togo': 8279000,
'Tonga': 106000,
'Tunisia': 11819000,
'Turkmenistan': 6031000,
'Tuvalu': 12000,
'Uganda': 45741000,
'Ukraine': 43734000,
'United Kingdom': 67886000,
'United States of America': 331003000,
'Uruguay': 3474000,
'Uzbekistan': 33469000,
'Vanuatu': 307000,
'Vietnam': 97339000,
'Zambia': 18384000,
'Zimbabwe': 14863000}),
"15-2": (TEXT_FORMAT_DICT, {'Afghanistan': 26,
'Albania': 62,
'Algeria': 74,
'Andorra': 88,
'Angola': 67,
'Armenia': 63,
'Australia': 86,
'Austria': 59,
'Azerbaijan': 56,
'Bangladesh': 38,
'Belarus': 79,
'Belgium': 98,
'Belize': 46,
'Benin': 48,
'Bermuda': 100,
'Bhutan': 42,
'Bosnia and Herzegovina': 49,
'Botswana': 71,
'Brazil': 87,
'Brunei Darussalam': 78,
'Bulgaria': 76,
'Burkina Faso': 31,
'Burundi': 14,
'Cabo Verde': 67,
'Cambodia': 24,
'Cameroon': 58,
'Canada': 82,
'Central African Republic': 42,
'Chad': 24,
'Chile': 88,
'China': 62,
'Colombia': 81,
'Costa Rica': 81,
"Côte d'Ivoire": 52,
'Cuba': 77,
'Cyprus': 67,
'Czech Republic': 74,
'Denmark': 88,
'Djibouti': 78,
'Dominican Republic': 83,
'Ecuador': 64,
'El Salvador': 73,
'Estonia': 69,
'Eswatini': 24,
'Ethiopia': 22,
'Fiji': 57,
'Finland': 86,
'France': 81,
'Gabon': 90,
'Georgia': 59,
'Germany': 77,
'Ghana': 57,
'Gibraltar': 100,
'Greece': 80,
'Greenland': 87,
'Guatemala': 52,
'Guinea': 37,
'Guinea-Bissau': 44,
'Guyana': 27,
'Haiti': 57,
'Honduras': 58,
'Hungary': 72,
'Iceland': 94,
'India': 35,
'Indonesia': 57,
'Iraq': 71,
'Ireland': 64,
'Israel': 93,
'Jamaica': 56,
'Jordan': 91,
'Kazakhstan': 58,
'Kenya': 28,
'Kiribati': 56,
'Latvia': 68,
'Lesotho': 29,
'Liberia': 52,
'Lithuania': 68,
'Luxembourg': 91,
'Madagascar': 39,
'Malawi': 17,
'Malaysia': 77,
'Maldives': 41,
'Mali': 44,
'Malta': 95,
'Marshall Islands': 78,
'Mauritania': 55,
'Mauritius': 41,
'Mexico': 81,
'Monaco': 100,
'Mongolia': 69,
'Montenegro': 67,
'Morocco': 64,
'Mozambique': 37,
'Myanmar': 31,
'Namibia': 52,
'Nauru': 100,
'Nepal': 21,
'Netherlands': 92,
'New Zealand': 87,
'Nicaragua': 59,
'Niger': 17,
'Nigeria': 52,
'North Macedonia': 58,
'Norway': 83,
'Oman': 86,
'Pakistan': 37,
'Palau': 81,
'Panama': 68,
'Papua New Guinea': 13,
'Paraguay': 62,
'Peru': 78,
'Philippines': 47,
'Poland': 60,
'Portugal': 66,
'Romania': 54,
'Russian Federation': 75,
'Rwanda': 17,
'Samoa': 18,
'Senegal': 48,
'Serbia': 56,
'Sierra Leone': 43,
'Singapore': 100,
'Solomon Islands': 25,
'Somalia': 46,
'South Africa': 67,
'South Sudan': 20,
'Spain': 81,
'Sri Lanka': 19,
'Sudan': 35,
'Suriname': 66,
'Sweden': 88,
'Switzerland': 74,
'Syrian Arab Republic': 55,
'Tajikistan': 28,
'Thailand': 51,
'Timor-Leste': 31,
'Togo': 43,
'Tonga': 23,
'Tunisia': 70,
'Turkmenistan': 53,
'Tuvalu': 64,
'Uganda': 25,
'Ukraine': 69,
'United Kingdom': 84,
'United States of America': 83,
'Uruguay': 96,
'Uzbekistan': 50,
'Vanuatu': 26,
'Vietnam': 37,
'Zambia': 45,
'Zimbabwe': 32}),
"16": (TEXT_FORMAT_DICT, {'Afghanistan': 10121280,
'Albania': 1784360,
'Algeria': 32449740,
'Andorra': 67760,
'Angola': 22020220,
'Armenia': 1866690,
'Australia': 21930000,
'Austria': 5313540,
'Azerbaijan': 5677840,
'Bangladesh': 62581820,
'Belarus': 7464710,
'Belgium': 11358200,
'Belize': 183080,
'Benin': 5819040,
'Bermuda': 62000,
'Bhutan': 324240,
'Bosnia and Herzegovina': 1607690,
'Botswana': 1669920,
'Brazil': 184926330,
'Brunei Darussalam': 340860,
'Bulgaria': 5280480,
'Burkina Faso': 6479930,
'Burundi': 1664740,
'Cabo Verde': 372520,
'Cambodia': 4012560,
'Cameroon': 15396680,
'Canada': 30948440,
'Central African Republic': 2028600,
'Chad': 3942240,
'Chile': 16822080,
'China': 907147420,
'Colombia': 41215230,
'Costa Rica': 4126140,
"Côte d'Ivoire": 13716560,
'Cuba': 8721790,
'Cyprus': 808690,
'Czech Republic': 7924660,
'Denmark': 5096960,
'Djibouti': 770640,
'Dominican Republic': 9003840,
'Ecuador': 11291520,
'El Salvador': 4734780,
'Estonia': 915630,
'Eswatini': 278400,
'Ethiopia': 25292080,
'Fiji': 510720,
'Finland': 4765260,
'France': 52871940,
'Gabon': 2003400,
'Georgia': 2353510,
'Germany': 64513680,
'Ghana': 17711610,
'Gibraltar': 34000,
'Greece': 8338400,
'Greenland': 49590,
'Guatemala': 9316320,
'Guinea': 4859210,
'Guinea-Bissau': 865920,
'Guyana': 212490,
'Haiti': 6499710,
'Honduras': 5744900,
'Hungary': 6955200,
'Iceland': 320540,
'India': 483001400,
'Indonesia': 155908680,
'Iraq': 28558330,
'Ireland': 3160320,
'Israel': 8050080,
'Jamaica': 1658160,
'Jordan': 9284730,
'Kazakhstan': 10890660,
'Kenya': 15055880,
'Kiribati': 66640,
'Latvia': 1282480,
'Lesotho': 621180,
'Liberia': 2630160,
'Lithuania': 1850960,
'Luxembourg': 569660,
'Madagascar': 10799490,
'Malawi': 3252100,
'Malaysia': 24921820,
'Maldives': 221810,
'Mali': 8910440,
'Malta': 419900,
'Marshall Islands': 46020,
'Mauritania': 2557500,
'Mauritius': 521520,
'Mexico': 104435730,
'Monaco': 39000,
'Mongolia': 2261820,
'Montenegro': 420760,
'Morocco': 23623040,
'Mozambique': 11564350,
'Myanmar': 16867100,
'Namibia': 1321320,
'Nauru': 11000,
'Nepal': 6118770,
'Netherlands': 15764200,
'New Zealand': 4195140,
'Nicaragua': 3908750,
'Niger': 4115190,
'Nigeria': 107192800,
'North Macedonia': 1208140,
'Norway': 4499430,
'Oman': 4392020,
'Pakistan': 81730040,
'Palau': 14580,
'Panama': 2934200,
'Papua New Guinea': 1163110,
'Paraguay': 4422460,
'Peru': 25718160,
'Philippines': 51503070,
'Poland': 22708200,
'Portugal': 6730020,
'Romania': 10388520,
'Russian Federation': 109450500,
'Rwanda': 2201840,
'Samoa': 35640,
'Senegal': 8037120,
'Serbia': 4892720,
'Sierra Leone': 3430110,
'Singapore': 5850000,
'Solomon Islands': 171750,
'Somalia': 7310780,
'South Africa': 39737030,
'South Sudan': 2238800,
'Spain': 37871550,
'Sri Lanka': 4068470,
'Sudan': 15347150,
'Suriname': 387420,
'Sweden': 8887120,
'Switzerland': 6404700,
'Syrian Arab Republic': 9625550,
'Tajikistan': 2670640,
'Thailand': 35598000,
'Timor-Leste': 408580,
'Togo': 3559970,
'Tonga': 24380,
'Tunisia': 8273300,
'Turkmenistan': 3196430,
'Tuvalu': 7680,
'Uganda': 11435250,
'Ukraine': 30176460,
'United Kingdom': 57024240,
'United States of America': 274732490,
'Uruguay': 3335040,
'Uzbekistan': 16734500,
'Vanuatu': 79820,
'Vietnam': 36015430,
'Zambia': 8272800,
'Zimbabwe': 4756160}),
"17": (TEXT_FORMAT, 'Tuvalu'),
"18": (TEXT_FORMAT, 'China'),
"19": (TEXT_FORMAT_DICT, {'Afghanistan': {2015: 'Low income',
2020: 'Low income',
'region': 'South Asia'},
'Albania': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Europe & Central Asia'},
'Algeria': {2015: 'Upper middle income',
2020: 'Lower middle income',
'region': 'Middle East & North Africa'},
'Andorra': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Angola': {2015: 'Upper middle income',
2020: 'Lower middle income',
'region': 'Sub-Saharan Africa'},
'Armenia': {2015: 'Lower middle income',
2020: 'Upper middle income',
'region': 'Europe & Central Asia'},
'Australia': {2015: 'High income',
2020: 'High income',
'region': 'East Asia & Pacific'},
'Austria': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Azerbaijan': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Europe & Central Asia'},
'Bangladesh': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'South Asia'},
'Belarus': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Europe & Central Asia'},
'Belgium': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Belize': {2015: 'Upper middle income',
2020: 'Lower middle income',
'region': 'Latin America & Caribbean'},
'Benin': {2015: 'Low income',
2020: 'Lower middle income',
'region': 'Sub-Saharan Africa'},
'Bermuda': {2015: 'High income',
2020: 'High income',
'region': 'North America'},
'Bhutan': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'South Asia'},
'Bosnia and Herzegovina': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Europe & Central Asia'},
'Botswana': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Sub-Saharan Africa'},
'Brazil': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Latin America & Caribbean'},
'Brunei Darussalam': {2015: 'High income',
2020: 'High income',
'region': 'East Asia & Pacific'},
'Bulgaria': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Europe & Central Asia'},
'Burkina Faso': {2015: 'Low income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'Burundi': {2015: 'Low income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'Cabo Verde': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'Sub-Saharan Africa'},
'Cambodia': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'East Asia & Pacific'},
'Cameroon': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'Sub-Saharan Africa'},
'Canada': {2015: 'High income',
2020: 'High income',
'region': 'North America'},
'Central African Republic': {2015: 'Low income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'Chad': {2015: 'Low income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'Chile': {2015: 'High income',
2020: 'High income',
'region': 'Latin America & Caribbean'},
'China': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'East Asia & Pacific'},
'Colombia': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Latin America & Caribbean'},
'Costa Rica': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Latin America & Caribbean'},
"Côte d'Ivoire": {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'Sub-Saharan Africa'},
'Cuba': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Latin America & Caribbean'},
'Cyprus': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Czech Republic': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Denmark': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Djibouti': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'Middle East & North Africa'},
'Dominican Republic': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Latin America & Caribbean'},
'Ecuador': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Latin America & Caribbean'},
'El Salvador': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'Latin America & Caribbean'},
'Estonia': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Eswatini': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'Sub-Saharan Africa'},
'Ethiopia': {2015: 'Low income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'Fiji': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'East Asia & Pacific'},
'Finland': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'France': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Gabon': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Sub-Saharan Africa'},
'Georgia': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Europe & Central Asia'},
'Germany': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Ghana': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'Sub-Saharan Africa'},
'Gibraltar': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Greece': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Greenland': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Guatemala': {2015: 'Lower middle income',
2020: 'Upper middle income',
'region': 'Latin America & Caribbean'},
'Guinea': {2015: 'Low income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'Guinea-Bissau': {2015: 'Low income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'Guyana': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Latin America & Caribbean'},
'Haiti': {2015: 'Low income',
2020: 'Lower middle income',
'region': 'Latin America & Caribbean'},
'Honduras': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'Latin America & Caribbean'},
'Hungary': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Iceland': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'India': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'South Asia'},
'Indonesia': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'East Asia & Pacific'},
'Iraq': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Middle East & North Africa'},
'Ireland': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Israel': {2015: 'High income',
2020: 'High income',
'region': 'Middle East & North Africa'},
'Jamaica': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Latin America & Caribbean'},
'Jordan': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Middle East & North Africa'},
'Kazakhstan': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Europe & Central Asia'},
'Kenya': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'Sub-Saharan Africa'},
'Kiribati': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'East Asia & Pacific'},
'Latvia': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Lesotho': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'Sub-Saharan Africa'},
'Liberia': {2015: 'Low income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'Lithuania': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Luxembourg': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Madagascar': {2015: 'Low income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'Malawi': {2015: 'Low income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'Malaysia': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'East Asia & Pacific'},
'Maldives': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'South Asia'},
'Mali': {2015: 'Low income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'Malta': {2015: 'High income',
2020: 'High income',
'region': 'Middle East & North Africa'},
'Marshall Islands': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'East Asia & Pacific'},
'Mauritania': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'Sub-Saharan Africa'},
'Mauritius': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Sub-Saharan Africa'},
'Mexico': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Latin America & Caribbean'},
'Monaco': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Mongolia': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'East Asia & Pacific'},
'Montenegro': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Europe & Central Asia'},
'Morocco': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'Middle East & North Africa'},
'Mozambique': {2015: 'Low income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'Myanmar': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'East Asia & Pacific'},
'Namibia': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Sub-Saharan Africa'},
'Nauru': {2015: 'High income',
2020: 'High income',
'region': 'East Asia & Pacific'},
'Nepal': {2015: 'Low income',
2020: 'Lower middle income',
'region': 'South Asia'},
'Netherlands': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'New Zealand': {2015: 'High income',
2020: 'High income',
'region': 'East Asia & Pacific'},
'Nicaragua': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'Latin America & Caribbean'},
'Niger': {2015: 'Low income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'Nigeria': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'Sub-Saharan Africa'},
'North Macedonia': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Europe & Central Asia'},
'Norway': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Oman': {2015: 'High income',
2020: 'High income',
'region': 'Middle East & North Africa'},
'Pakistan': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'South Asia'},
'Palau': {2015: 'Upper middle income',
2020: 'High income',
'region': 'East Asia & Pacific'},
'Panama': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Latin America & Caribbean'},
'Papua New Guinea': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'East Asia & Pacific'},
'Paraguay': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Latin America & Caribbean'},
'Peru': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Latin America & Caribbean'},
'Philippines': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'East Asia & Pacific'},
'Poland': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Portugal': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Romania': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Europe & Central Asia'},
'Russian Federation': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Europe & Central Asia'},
'Rwanda': {2015: 'Low income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'Samoa': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'East Asia & Pacific'},
'Senegal': {2015: 'Low income',
2020: 'Lower middle income',
'region': 'Sub-Saharan Africa'},
'Serbia': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Europe & Central Asia'},
'Sierra Leone': {2015: 'Low income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'Singapore': {2015: 'High income',
2020: 'High income',
'region': 'East Asia & Pacific'},
'Solomon Islands': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'East Asia & Pacific'},
'Somalia': {2015: 'Low income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'South Africa': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Sub-Saharan Africa'},
'South Sudan': {2015: 'Low income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'Spain': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Sri Lanka': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'South Asia'},
'Sudan': {2015: 'Lower middle income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'Suriname': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Latin America & Caribbean'},
'Sweden': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Switzerland': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'Syrian Arab Republic': {2015: 'Lower middle income',
2020: 'Low income',
'region': 'Middle East & North Africa'},
'Tajikistan': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'Europe & Central Asia'},
'Thailand': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'East Asia & Pacific'},
'Timor-Leste': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'East Asia & Pacific'},
'Togo': {2015: 'Low income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'Tonga': {2015: 'Lower middle income',
2020: 'Upper middle income',
'region': 'East Asia & Pacific'},
'Tunisia': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'Middle East & North Africa'},
'Turkmenistan': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'Europe & Central Asia'},
'Tuvalu': {2015: 'Upper middle income',
2020: 'Upper middle income',
'region': 'East Asia & Pacific'},
'Uganda': {2015: 'Low income',
2020: 'Low income',
'region': 'Sub-Saharan Africa'},
'Ukraine': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'Europe & Central Asia'},
'United Kingdom': {2015: 'High income',
2020: 'High income',
'region': 'Europe & Central Asia'},
'United States of America': {2015: 'High income',
2020: 'High income',
'region': 'North America'},
'Uruguay': {2015: 'High income',
2020: 'High income',
'region': 'Latin America & Caribbean'},
'Uzbekistan': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'Europe & Central Asia'},
'Vanuatu': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'East Asia & Pacific'},
'Vietnam': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'East Asia & Pacific'},
'Zambia': {2015: 'Lower middle income',
2020: 'Lower middle income',
'region': 'Sub-Saharan Africa'},
'Zimbabwe': {2015: 'Low income',
2020: 'Lower middle income',
'region': 'Sub-Saharan Africa'}}),
"20": (TEXT_FORMAT_DICT, {'South Asia': ['Bangladesh',
'Bhutan',
'India',
'Nepal',
'Pakistan',
'Sri Lanka'],
'Europe & Central Asia': ['Tajikistan', 'Ukraine', 'Uzbekistan'],
'Middle East & North Africa': ['Algeria', 'Djibouti', 'Morocco', 'Tunisia'],
'Sub-Saharan Africa': ['Angola',
'Benin',
'Cabo Verde',
'Cameroon',
"Côte d'Ivoire",
'Eswatini',
'Ghana',
'Kenya',
'Lesotho',
'Mauritania',
'Nigeria',
'Senegal',
'Zambia',
'Zimbabwe'],
'East Asia & Pacific': ['Cambodia',
'Indonesia',
'Kiribati',
'Mongolia',
'Myanmar',
'Papua New Guinea',
'Philippines',
'Samoa',
'Solomon Islands',
'Timor-Leste',
'Vanuatu',
'Vietnam'],
'Latin America & Caribbean': ['Belize',
'El Salvador',
'Haiti',
'Honduras',
'Nicaragua'],
'North America': []})}
def check_cell(qnum, actual):
format, expected = expected_json[qnum[1:]]
try:
if format == TEXT_FORMAT:
return simple_compare(expected, actual)
elif format == TEXT_FORMAT_UNORDERED_LIST:
return list_compare_unordered(expected, actual)
elif format == TEXT_FORMAT_ORDERED_LIST:
return list_compare_ordered(expected, actual)
elif format == TEXT_FORMAT_DICT:
return dict_compare(expected, actual)
else:
if expected != actual:
return "expected %s but found %s " % (repr(expected), repr(actual))
except:
if expected != actual:
return "expected %s" % (repr(expected))
return PASS
def simple_compare(expected, actual, complete_msg=True):
msg = PASS
if type(expected) == type:
if expected != actual:
if type(actual) == type:
msg = "expected %s but found %s" % (
expected.__name__, actual.__name__)
else:
msg = "expected %s but found %s" % (
expected.__name__, repr(actual))
elif type(expected) != type(actual) and not (type(expected) in [float, int] and type(actual) in [float, int]):
msg = "expected to find type %s but found type %s" % (
type(expected).__name__, type(actual).__name__)
elif type(expected) == float:
if not math.isclose(actual, expected, rel_tol=REL_TOL, abs_tol=ABS_TOL):
msg = "expected %s" % (repr(expected))
if complete_msg:
msg = msg + " but found %s" % (repr(actual))
else:
if expected != actual:
msg = "expected %s" % (repr(expected))
if complete_msg:
msg = msg + " but found %s" % (repr(actual))
return msg
def namedtuple_compare(expected, actual):
msg = PASS
for field in expected._fields:
val = simple_compare(getattr(expected, field), getattr(actual, field))
if val != PASS:
msg = "at attribute %s of namedtuple %s, " % (
field, type(expected).__name__) + val
return msg
return msg
def list_compare_ordered(expected, actual, obj="list"):
msg = PASS
if type(expected) != type(actual):
msg = "expected to find type %s but found type %s" % (
type(expected).__name__, type(actual).__name__)
return msg
for i in range(len(expected)):
if i >= len(actual):
msg = "expected missing %s in %s" % (repr(expected[i]), obj)
break
if type(expected[i]) in [int, float, bool, str]:
val = simple_compare(expected[i], actual[i])
elif type(expected[i]) in [list]:
val = list_compare_ordered(expected[i], actual[i], "sub" + obj)
elif type(expected[i]) in [dict]:
val = dict_compare(expected[i], actual[i])
elif type(expected[i]).__name__ == obfuscate1():
val = simple_compare(expected[i], actual[i])
if val != PASS:
msg = "at index %d of the %s, " % (i, obj) + val
break
if len(actual) > len(expected) and msg == PASS:
msg = "found unexpected %s in %s" % (repr(actual[len(expected)]), obj)
if len(expected) != len(actual):
msg = msg + \
" (found %d entries in %s, but expected %d)" % (
len(actual), obj, len(expected))
if len(expected) > 0 and type(expected[0]) in [int, float, bool, str]:
if msg != PASS and list_compare_unordered(expected, actual, obj) == PASS:
try:
msg = msg + " (list may not be ordered as required)"
except:
pass
return msg
def list_compare_helper(larger, smaller):
msg = PASS
j = 0
for i in range(len(larger)):
if i == len(smaller):
msg = "expected %s" % (repr(larger[i]))
break
found = False
while not found:
if j == len(smaller):
val = simple_compare(larger[i], smaller[j - 1], False)
break
val = simple_compare(larger[i], smaller[j], False)
j += 1
if val == PASS:
found = True
break
if not found:
msg = val
break
return msg
def list_compare_unordered(expected, actual, obj="list"):
msg = PASS
if type(expected) != type(actual):
msg = "expected to find type %s but found type %s" % (
type(expected).__name__, type(actual).__name__)
return msg
try:
sort_expected = sorted(expected)
sort_actual = sorted(actual)
except:
msg = "unexpected datatype found in %s; expected entries of type %s" % (
obj, obj, type(expected[0]).__name__)
return msg
if len(actual) == 0 and len(expected) > 0:
msg = "in the %s, missing" % (obj) + expected[0]
elif len(actual) > 0 and len(expected) > 0:
val = simple_compare(sort_expected[0], sort_actual[0])
if val.startswith("expected to find type"):
msg = "in the %s, " % (
obj) + simple_compare(sort_expected[0], sort_actual[0])
else:
if len(expected) > len(actual):
msg = "in the %s, missing " % (
obj) + list_compare_helper(sort_expected, sort_actual)
elif len(expected) < len(actual):
msg = "in the %s, found un" % (
obj) + list_compare_helper(sort_actual, sort_expected)
if len(expected) != len(actual):
msg = msg + \
" (found %d entries in %s, but expected %d)" % (
len(actual), obj, len(expected))
return msg
else:
val = list_compare_helper(sort_expected, sort_actual)
if val != PASS:
msg = "in the %s, missing " % (obj) + val + ", but found un" + list_compare_helper(sort_actual,
sort_expected)
return msg
def list_compare_special_init(expected, special_order):
real_expected = []
for i in range(len(expected)):
if real_expected == [] or special_order[i-1] != special_order[i]:
real_expected.append([])
real_expected[-1].append(expected[i])
return real_expected
def list_compare_special(expected, actual, special_order):
expected = list_compare_special_init(expected, special_order)
msg = PASS
expected_list = []
for expected_item in expected:
expected_list.extend(expected_item)
val = list_compare_unordered(expected_list, actual)
if val != PASS:
msg = val
else:
i = 0
for expected_item in expected:
j = len(expected_item)
actual_item = actual[i: i + j]
val = list_compare_unordered(expected_item, actual_item)
if val != PASS:
if j == 1:
msg = "at index %d " % (i) + val
else:
msg = "between indices %d and %d " % (i, i + j - 1) + val
msg = msg + " (list may not be ordered as required)"
break
i += j
return msg
def dict_compare(expected, actual, obj="dict"):
msg = PASS
if type(expected) != type(actual):
msg = "expected to find type %s but found type %s" % (
type(expected).__name__, type(actual).__name__)
return msg
try:
expected_keys = sorted(list(expected.keys()))
actual_keys = sorted(list(actual.keys()))
except:
msg = "unexpected datatype found in keys of dict; expect a dict with keys of type %s" % (
type(expected_keys[0]).__name__)
return msg
val = list_compare_unordered(expected_keys, actual_keys, "dict")
if val != PASS:
msg = "bad keys in %s: " % (obj) + val
if msg == PASS:
for key in expected:
if expected[key] == None or type(expected[key]) in [int, float, bool, str]:
val = simple_compare(expected[key], actual[key])
elif type(expected[key]) in [list]:
val = list_compare_ordered(expected[key], actual[key], "value")
elif type(expected[key]) in [dict]:
val = dict_compare(expected[key], actual[key], "sub" + obj)
if val != PASS:
msg = "incorrect val for key %s in %s: " % (
repr(key), obj) + val
return msg
def check(qnum, actual):
msg = check_cell(qnum, actual)
if msg == PASS:
return True
print("<b style='color: red;'>ERROR:</b> " + msg)