@mock.patch(COUNTRY_ISO_CODE)
def test_valid_countries_coded(self, mocked_country_iso_code):
    test_df = pd.DataFrame({'index': [0, 1, 2], 'country': ['United Kingdom', 'Belgium', 'United States']})
    mocked_response_uk = self._mocked_response('GB', 'GBR', '123', 'EU')
    mocked_response_be = self._mocked_response('BE', 'BEL', '875', 'EU')
    mocked_response_us = self._mocked_response('US', 'USA', '014', 'NA')
    mocked_country_iso_code.side_effect = [mocked_response_uk, mocked_response_be, mocked_response_us]
    expected_dataframe = pd.DataFrame({'index': [0, 1, 2], 'country': ['United Kingdom', 'Belgium', 'United States'], 'country_alpha_2': ['GB', 'BE', 'US'], 'country_alpha_3': ['GBR', 'BEL', 'USA'], 'country_numeric': ['123', '875', '014'], 'continent': ['EU', 'EU', 'NA']})
    coded_df = country_iso_code_dataframe(test_df)
    assert (coded_df.to_dict(orient='records') == expected_dataframe.to_dict(orient='records'))
@mock.patch(COUNTRY_ISO_CODE)
def test_valid_countries_coded(self, mocked_country_iso_code):
    test_df = pd.DataFrame({'index': [0, 1, 2], 'country': ['United Kingdom', 'Belgium', 'United States']})
    mocked_response_uk = self._mocked_response('GB', 'GBR', '123', 'EU')
    mocked_response_be = self._mocked_response('BE', 'BEL', '875', 'EU')
    mocked_response_us = self._mocked_response('US', 'USA', '014', 'NA')
    mocked_country_iso_code.side_effect = [mocked_response_uk, mocked_response_be, mocked_response_us]
    expected_dataframe = pd.DataFrame({'index': [0, 1, 2], 'country': ['United Kingdom', 'Belgium', 'United States'], 'country_alpha_2': ['GB', 'BE', 'US'], 'country_alpha_3': ['GBR', 'BEL', 'USA'], 'country_numeric': ['123', '875', '014'], 'continent': ['EU', 'EU', 'NA']})
    coded_df = country_iso_code_dataframe(test_df)
    assert (coded_df.to_dict(orient='records') == expected_dataframe.to_dict(orient='records'))