Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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