def canonicalize(cls): """ Transforms the values in `city_name` and `county_name` to their canonicalized (uppercase, regulare spaced) form. """ for obj in cls.objects.all(): obj.city_name = canonicalize_string(obj.city_name) obj.county_name = canonicalize_string(obj.county_name) obj.save()
def test_canonicalize_string(): assert helpers.canonicalize_string(" Däytön\n") == "DÄYTÖN"
def test_canonicalize_string(): raw = ' Däytön\n' assert h.canonicalize_string(raw) == 'DÄYTÖN'
def test_canonicalize_string(): raw = " Däytön\n" assert h.canonicalize_string(raw) == "DÄYTÖN"