Skip to content

Commit

Permalink
expect SyntaxWarning in test_deprecated_escape() under Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
xflr6 committed Oct 24, 2023
1 parent 3214517 commit 5ce9fc5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/test_quoting.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import warnings

import pytest
Expand All @@ -14,7 +15,8 @@ def test_deprecated_escape(recwarn, char):
escape = eval(rf'"\{char}"')

assert len(recwarn) == 1
w = recwarn.pop(DeprecationWarning)
w = recwarn.pop(DeprecationWarning if sys.version_info < (3, 12)
else SyntaxWarning)
assert str(w.message).startswith('invalid escape sequence')

assert escape == f'\\{char}'
Expand Down

0 comments on commit 5ce9fc5

Please sign in to comment.