Skip to content
Permalink
Browse files

normalize_letter_suffix: don't loose the provided source_suffix

'42a*' should be normalized as '42/A*', not as just '42/A'.

Related to
<#299 (comment)>.

Tested-by: Travis
  • Loading branch information
vmiklos authored and Travis CI committed Dec 14, 2019
1 parent b9659ed commit 1db00c9a0b458af254de3e25e9bc10453621e371
Showing with 3 additions and 3 deletions.
  1. +1 −1 tests/test_util.py
  2. +2 −2 util.py
@@ -279,7 +279,7 @@ def test_normalize_letter_suffix(self) -> None:
self.assertEqual(normalize("42 a", "", util.LetterSuffixStyle.UPPER), "42/A")
self.assertEqual(normalize("42/a", "", util.LetterSuffixStyle.UPPER), "42/A")
self.assertEqual(normalize("42/A", "", util.LetterSuffixStyle.UPPER), "42/A")
self.assertEqual(normalize("42/A*", "*", util.LetterSuffixStyle.UPPER), "42/A")
self.assertEqual(normalize("42/A*", "*", util.LetterSuffixStyle.UPPER), "42/A*")
self.assertEqual(normalize("42 A", "", util.LetterSuffixStyle.UPPER), "42/A")
with self.assertRaises(ValueError):
util.HouseNumber.normalize_letter_suffix("x", "", util.LetterSuffixStyle.UPPER)
@@ -111,8 +111,8 @@ def normalize_letter_suffix(house_number: str, source_suffix: str, style: Letter
raise ValueError
groups = match.groups()
if style == LetterSuffixStyle.UPPER:
return groups[0] + "/" + groups[2].upper()
return groups[0] + groups[2].lower()
return groups[0] + "/" + groups[2].upper() + source_suffix
return groups[0] + groups[2].lower() + source_suffix


def format_even_odd(only_in_ref: List[str], doc: Optional[yattag.Doc]) -> List[str]:

0 comments on commit 1db00c9

Please sign in to comment.
You can’t perform that action at this time.