From 1acd425252dd0269c213ebd570b3794b1194cfea Mon Sep 17 00:00:00 2001 From: Mingun Date: Mon, 15 Apr 2024 21:29:48 +0500 Subject: [PATCH] Python: fix DeprecationWarning: invalid escape sequence '\d' with self.assertRaisesRegex(EOFError, "^requested \d+ bytes, but only \d+ bytes available$"): --- spec/python/test_eof_exception_bytes.py | 2 +- spec/python/test_eof_exception_u4.py | 2 +- spec/python/test_eos_exception_bytes.py | 2 +- spec/python/test_eos_exception_u4.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/python/test_eof_exception_bytes.py b/spec/python/test_eof_exception_bytes.py index 31a42d681..8ae4ec81b 100644 --- a/spec/python/test_eof_exception_bytes.py +++ b/spec/python/test_eof_exception_bytes.py @@ -3,6 +3,6 @@ class TestEofExceptionBytes(BaseTest): def test_eof_exception_bytes(self): - with self.assertRaisesRegex(EOFError, "^requested \d+ bytes, but only \d+ bytes available$"): + with self.assertRaisesRegex(EOFError, r"^requested \d+ bytes, but only \d+ bytes available$"): with EofExceptionBytes.from_file('src/term_strz.bin') as r: pass diff --git a/spec/python/test_eof_exception_u4.py b/spec/python/test_eof_exception_u4.py index 88838d085..9d6447b7a 100644 --- a/spec/python/test_eof_exception_u4.py +++ b/spec/python/test_eof_exception_u4.py @@ -3,6 +3,6 @@ class TestEofExceptionU4(BaseTest): def test_eof_exception_u4(self): - with self.assertRaisesRegex(EOFError, "^requested \d+ bytes, but only \d+ bytes available$"): + with self.assertRaisesRegex(EOFError, r"^requested \d+ bytes, but only \d+ bytes available$"): with EofExceptionU4.from_file('src/term_strz.bin') as r: pass diff --git a/spec/python/test_eos_exception_bytes.py b/spec/python/test_eos_exception_bytes.py index 899eeb841..7ab40463b 100644 --- a/spec/python/test_eos_exception_bytes.py +++ b/spec/python/test_eos_exception_bytes.py @@ -3,6 +3,6 @@ class TestEosExceptionBytes(BaseTest): def test_eos_exception_bytes(self): - with self.assertRaisesRegex(EOFError, "^requested \d+ bytes, but only \d+ bytes available$"): + with self.assertRaisesRegex(EOFError, r"^requested \d+ bytes, but only \d+ bytes available$"): with EosExceptionBytes.from_file('src/term_strz.bin') as r: pass diff --git a/spec/python/test_eos_exception_u4.py b/spec/python/test_eos_exception_u4.py index edf5bfb79..83207aa6e 100644 --- a/spec/python/test_eos_exception_u4.py +++ b/spec/python/test_eos_exception_u4.py @@ -3,6 +3,6 @@ class TestEosExceptionU4(BaseTest): def test_eos_exception_u4(self): - with self.assertRaisesRegex(EOFError, "^requested \d+ bytes, but only \d+ bytes available$"): + with self.assertRaisesRegex(EOFError, r"^requested \d+ bytes, but only \d+ bytes available$"): with EosExceptionU4.from_file('src/term_strz.bin') as r: pass