From: Aarni Koskela Date: Mon, 28 May 2018 09:37:17 +0000 (+0300) Subject: test_support: Don't use deprecated inspect methods X-Git-Tag: v2.6.0~2^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a9c634c48e90c01653a96b290fd40eccae34eb7;p=thirdparty%2Fbabel.git test_support: Don't use deprecated inspect methods --- diff --git a/tests/test_support.py b/tests/test_support.py index 64b60d85..314c1882 100644 --- a/tests/test_support.py +++ b/tests/test_support.py @@ -24,6 +24,8 @@ from babel.messages import Catalog from babel.messages.mofile import write_mo from babel._compat import BytesIO, PY2 +get_arg_spec = (inspect.getargspec if PY2 else inspect.getfullargspec) + @pytest.mark.usefixtures("os_environ") class TranslationsTestCase(unittest.TestCase): @@ -206,9 +208,10 @@ class NullTranslationsTestCase(unittest.TestCase): for name in self.method_names(): translations_method = getattr(self.translations, name) null_method = getattr(self.null_translations, name) - signature = inspect.getargspec - self.assertEqual(signature(translations_method), - signature(null_method)) + self.assertEqual( + get_arg_spec(translations_method), + get_arg_spec(null_method), + ) def test_same_return_values(self): data = { @@ -219,8 +222,8 @@ class NullTranslationsTestCase(unittest.TestCase): for name in self.method_names(): method = getattr(self.translations, name) null_method = getattr(self.null_translations, name) - signature = inspect.getargspec(method) - parameter_names = [name for name in signature[0] if name != 'self'] + signature = get_arg_spec(method) + parameter_names = [name for name in signature.args if name != 'self'] values = [data[name] for name in parameter_names] self.assertEqual(method(*values), null_method(*values))