Skip to content

Commit

Permalink
Empty city is allowed when postcode is 99990. Empty city is allowed w…
Browse files Browse the repository at this point in the history
…hen postcode matches Paris/Lyon/Marseille arrondissement
  • Loading branch information
wblondel committed Jan 31, 2021
1 parent 4e8243e commit 10bfd02
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions insee-deaths-manager/data_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def dates_are_int(row):


def city_empty_when_postcode_990(row):
if row[3].endswith('990'):
if row[3].endswith('990') and not row[3].startswith('99'):
return not row[4]
return True

Expand All @@ -40,15 +40,15 @@ def city_correctly_formated_when_arrondissement(row):
import regex

if row[3].startswith('751'):
return regex.match(r'(^PARIS \d{1,2}$)', row[4])
return regex.match(r'(^PARIS \d{1,2}$)', row[4]) or row[4] == ""

if row[3].startswith('6938'):
if row[3] == '69389' and row[4] == "SAINT-RAMBERT-L'ILE-BARBE":
return True
return regex.match(r'(^LYON \d{1,2}$)', row[4])
return regex.match(r'(^LYON \d{1,2}$)', row[4]) or row[4] == ""

if row[3].startswith('132'):
return regex.match(r'(^MARSEILLE \d{1,2}$)', row[4])
return regex.match(r'(^MARSEILLE \d{1,2}$)', row[4]) or row[4] == ""

return True

Expand Down

0 comments on commit 10bfd02

Please sign in to comment.