From b1e3eaff1552efcf9fcb637abb9ffb3db2b57976 Mon Sep 17 00:00:00 2001 From: Lele Gaifax Date: Thu, 3 Dec 2015 13:38:28 +0100 Subject: [PATCH] Avoid deprecation warning due to renamed assertion method in Py3.2+ --- dulwich/tests/test_repository.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dulwich/tests/test_repository.py b/dulwich/tests/test_repository.py index 941a9bb58..c7aa85ae9 100644 --- a/dulwich/tests/test_repository.py +++ b/dulwich/tests/test_repository.py @@ -125,8 +125,13 @@ def test_getitem_unicode(self): for k, contained in test_keys: self.assertEqual(k in r, contained) + # Avoid deprecation warning under Py3.2+ + if hasattr(self, 'assertRaisesRegex'): + assertRaisesRegexp = self.assertRaisesRegex + else: + assertRaisesRegexp = self.assertRaisesRegexp for k, _ in test_keys: - self.assertRaisesRegexp( + assertRaisesRegexp( TypeError, "'name' must be bytestring, not int", r.__getitem__, 12 )