Skip to content

Commit

Permalink
Correct regex A-z typo (#374)
Browse files Browse the repository at this point in the history
* Correct regex A-z typo

* Remove unneeded lines from test

* Remove more unneeded...

* black
  • Loading branch information
altendky authored Jul 4, 2020
1 parent c99f242 commit 1e347cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pendulum/formatting/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+"
r"|[\u0600-\u06FF/]+(\s*?[\u0600-\u06FF]+){1,2}"
)
_MATCH_TIMEZONE = "[A-za-z0-9-+]+(/[A-Za-z0-9-+_]+)?"
_MATCH_TIMEZONE = "[A-Za-z0-9-+]+(/[A-Za-z0-9-+_]+)?"


class Formatter:
Expand Down
7 changes: 7 additions & 0 deletions tests/datetime/test_from_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ def test_from_format_with_timezone():
assert "Europe/London" == d.timezone_name


def test_from_format_with_square_bracket_in_timezone():
with pytest.raises(ValueError, match="^String does not match format"):
pendulum.from_format(
"1975-05-21 22:32:11 Eu[rope/London", "YYYY-MM-DD HH:mm:ss z",
)


def test_from_format_with_escaped_elements():
d = pendulum.from_format("1975-05-21T22:32:11+00:00", "YYYY-MM-DD[T]HH:mm:ssZ")
assert_datetime(d, 1975, 5, 21, 22, 32, 11)
Expand Down

0 comments on commit 1e347cd

Please sign in to comment.