From eec9864a35a950c026b46cbf8e8da7201180c40a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miriam=20Espa=C3=B1a=20Acebal?= Date: Thu, 6 Jun 2024 17:09:11 +0200 Subject: [PATCH 1/2] Fix DeprecationError when ussing assert_ since python 3.12 --- tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.py b/tests.py index f6d7066..6906c99 100644 --- a/tests.py +++ b/tests.py @@ -88,7 +88,7 @@ def dump_object_hook(obj): x = phpserialize.dumps(user, object_hook=dump_object_hook) y = phpserialize.loads(x, object_hook=load_object_hook, decode_strings=True) - self.assert_(b'WP_User' in x) + self.assertTrue(b'WP_User' in x) self.assertEqual(type(y), type(user)) self.assertEqual(y.username, user.username) From 792ecf10a7796c512d249bf567708ec1a7763f7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miriam=20Espa=C3=B1a=20Acebal?= Date: Tue, 11 Jun 2024 15:42:52 +0200 Subject: [PATCH 2/2] Update tests.py by ussing assertIn As noted by bdrung, it will throw a better error message when needed. Co-authored-by: Benjamin Drung --- tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.py b/tests.py index 6906c99..6112d12 100644 --- a/tests.py +++ b/tests.py @@ -88,7 +88,7 @@ def dump_object_hook(obj): x = phpserialize.dumps(user, object_hook=dump_object_hook) y = phpserialize.loads(x, object_hook=load_object_hook, decode_strings=True) - self.assertTrue(b'WP_User' in x) + self.assertIn(b'WP_User', x) self.assertEqual(type(y), type(user)) self.assertEqual(y.username, user.username)