Skip to content

Commit

Permalink
Merge branch 'master' into require-types-dateutil
Browse files Browse the repository at this point in the history
  • Loading branch information
anishnya authored Sep 3, 2022
2 parents 1b94a9b + f8f3068 commit 40aa9ea
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
6 changes: 5 additions & 1 deletion arrow/locales.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ class ItalianLocale(Locale):
"hours": "{0} ore",
"day": "un giorno",
"days": "{0} giorni",
"week": "una settimana,",
"week": "una settimana",
"weeks": "{0} settimane",
"month": "un mese",
"months": "{0} mesi",
Expand Down Expand Up @@ -3709,6 +3709,8 @@ class HungarianLocale(Locale):
"hours": {"past": "{0} órával", "future": "{0} óra"},
"day": {"past": "egy nappal", "future": "egy nap"},
"days": {"past": "{0} nappal", "future": "{0} nap"},
"week": {"past": "egy héttel", "future": "egy hét"},
"weeks": {"past": "{0} héttel", "future": "{0} hét"},
"month": {"past": "egy hónappal", "future": "egy hónap"},
"months": {"past": "{0} hónappal", "future": "{0} hónap"},
"year": {"past": "egy évvel", "future": "egy év"},
Expand Down Expand Up @@ -4137,6 +4139,8 @@ class RomanshLocale(Locale):
"hours": "{0} ura",
"day": "in di",
"days": "{0} dis",
"week": "in'emna",
"weeks": "{0} emnas",
"month": "in mais",
"months": "{0} mais",
"year": "in onn",
Expand Down
2 changes: 1 addition & 1 deletion arrow/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ def _generate_choice_re(

class TzinfoParser:
_TZINFO_RE: ClassVar[Pattern[str]] = re.compile(
r"^([\+\-])?(\d{2})(?:\:?(\d{2}))?$"
r"^(?:\(UTC)*([\+\-])?(\d{2})(?:\:?(\d{2}))?"
)

@classmethod
Expand Down
6 changes: 6 additions & 0 deletions tests/test_locales.py
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,12 @@ def test_format_timeframe(self):
assert self.locale._format_timeframe("days", -2) == "2 nappal"
assert self.locale._format_timeframe("days", 2) == "2 nap"

# Week(s)
assert self.locale._format_timeframe("week", -1) == "egy héttel"
assert self.locale._format_timeframe("week", 1) == "egy hét"
assert self.locale._format_timeframe("weeks", -2) == "2 héttel"
assert self.locale._format_timeframe("weeks", 2) == "2 hét"

# Month(s)
assert self.locale._format_timeframe("month", -1) == "egy hónappal"
assert self.locale._format_timeframe("month", 1) == "egy hónap"
Expand Down
8 changes: 8 additions & 0 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,14 @@ def test_parse_utc(self):
assert self.parser.parse("utc") == tz.tzutc()
assert self.parser.parse("UTC") == tz.tzutc()

def test_parse_utc_withoffset(self):
assert self.parser.parse("(UTC+01:00") == tz.tzoffset(None, 3600)
assert self.parser.parse("(UTC-01:00") == tz.tzoffset(None, -3600)
assert self.parser.parse("(UTC+01:00") == tz.tzoffset(None, 3600)
assert self.parser.parse(
"(UTC+01:00) Amsterdam, Berlin, Bern, Rom, Stockholm, Wien"
) == tz.tzoffset(None, 3600)

def test_parse_iso(self):

assert self.parser.parse("01:00") == tz.tzoffset(None, 3600)
Expand Down

0 comments on commit 40aa9ea

Please sign in to comment.