diff --git a/pendulum/formatting/formatter.py b/pendulum/formatting/formatter.py index c6ed389a..76a4db4f 100644 --- a/pendulum/formatting/formatter.py +++ b/pendulum/formatting/formatter.py @@ -25,8 +25,8 @@ _MATCH_5_TO_6 = "\d{5}\d?" _MATCH_UNSIGNED = "\d+" _MATCH_SIGNED = "[+-]?\d+" -_MATCH_OFFSET = "(?i)Z|[+-]\d\d:?\d\d" -_MATCH_SHORT_OFFSET = "(?i)Z|[+-]\d\d(?::?\d\d)?" +_MATCH_OFFSET = "[Zz]|[+-]\d\d:?\d\d" +_MATCH_SHORT_OFFSET = "[Zz]|[+-]\d\d(?::?\d\d)?" _MATCH_TIMESTAMP = "[+-]?\d+(\.\d{1,6})?" _MATCH_WORD = ( "(?i)[0-9]*" diff --git a/tests/formatting/test_formatter.py b/tests/formatting/test_formatter.py index 40f2ee8e..80bb4517 100644 --- a/tests/formatting/test_formatter.py +++ b/tests/formatting/test_formatter.py @@ -238,8 +238,8 @@ def test_date_formats(): def test_escape(): f = Formatter() d = pendulum.datetime(2016, 8, 28) - assert f.format(d, "[YYYY] YYYY \[YYYY\]") == "YYYY 2016 [2016]" - assert f.format(d, "\D D \\\D") == "D 28 \\28" + assert f.format(d, r"[YYYY] YYYY \[YYYY\]") == "YYYY 2016 [2016]" + assert f.format(d, r"\D D \\D") == "D 28 \\28" def test_date_formats_missing():