File python312-syntax-warning.patch of Package python-graphviz

From 5ce9fc5de4f2284baa27d7a8d68ab0885d032868 Mon Sep 17 00:00:00 2001
From: Sebastian Bank <sebastian.bank@uni-leipzig.de>
Date: Tue, 24 Oct 2023 20:39:52 +0200
Subject: [PATCH] expect SyntaxWarning in test_deprecated_escape() under Python
 3.12

https://docs.python.org/3.12/whatsnew/3.12.html#other-language-changes
---
 tests/test_quoting.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: graphviz-0.20.1/tests/test_quoting.py
===================================================================
--- graphviz-0.20.1.orig/tests/test_quoting.py
+++ graphviz-0.20.1/tests/test_quoting.py
@@ -1,3 +1,4 @@
+import sys
 import warnings
 
 import pytest
@@ -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}'
openSUSE Build Service is sponsored by