+def test_discard_badly_formatted_postcodes(dsn, tmp_path, temp_db_cursor, place_row, postcode_table, tokenizer):
+ #Rewrite the get_country_code function to verify its execution.
+ temp_db_cursor.execute("""
+ CREATE OR REPLACE FUNCTION get_country_code(place geometry)
+ RETURNS TEXT AS $$ BEGIN
+ RETURN 'fr';
+ END; $$ LANGUAGE plpgsql;
+ """)
+ place_row(geom='SRID=4326;POINT(10 12)', address=dict(postcode='AB 4511'))
+ postcodes.update_postcodes(dsn, tmp_path, tokenizer)
+
+ assert not postcode_table.row_set