Author: Nick Desaulniers Date: 2020-08-10T15:25:23-07:00 New Revision: 05d74dbc3bb1d943a029e4abea211288c920f559
URL: https://github.com/llvm/llvm-project/commit/05d74dbc3bb1d943a029e4abea211288c920f559 DIFF: https://github.com/llvm/llvm-project/commit/05d74dbc3bb1d943a029e4abea211288c920f559.diff LOG: python bindings: fix DeprecationWarning Fixes observed warning running `ninja check-all`: llvm-project/clang/bindings/python/tests/cindex/test_diagnostics.py:100: DeprecationWarning: Please use assertRegex instead. self.assertRegexpMatches(children[0].spelling Looks like unittest.assertRegexpMatches has been deprecated in favor of unittest.assertRegex since Python 3.2, according to: https://docs.python.org/3/library/unittest.html#deprecated-aliases Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D85692 Added: Modified: clang/bindings/python/tests/cindex/test_diagnostics.py Removed: ################################################################################ diff --git a/clang/bindings/python/tests/cindex/test_diagnostics.py b/clang/bindings/python/tests/cindex/test_diagnostics.py index 64d0ca2ef9bc..8b0f04256883 100644 --- a/clang/bindings/python/tests/cindex/test_diagnostics.py +++ b/clang/bindings/python/tests/cindex/test_diagnostics.py @@ -41,7 +41,7 @@ def test_diagnostic_fixit(self): self.assertEqual(tu.diagnostics[0].severity, Diagnostic.Warning) self.assertEqual(tu.diagnostics[0].location.line, 1) self.assertEqual(tu.diagnostics[0].location.column, 26) - self.assertRegexpMatches(tu.diagnostics[0].spelling, + self.assertRegex(tu.diagnostics[0].spelling, 'use of GNU old-style.*') self.assertEqual(len(tu.diagnostics[0].fixits), 1) self.assertEqual(tu.diagnostics[0].fixits[0].range.start.line, 1) @@ -56,7 +56,7 @@ def test_diagnostic_range(self): self.assertEqual(tu.diagnostics[0].severity, Diagnostic.Warning) self.assertEqual(tu.diagnostics[0].location.line, 1) self.assertEqual(tu.diagnostics[0].location.column, 16) - self.assertRegexpMatches(tu.diagnostics[0].spelling, + self.assertRegex(tu.diagnostics[0].spelling, 'incompatible pointer to.*') self.assertEqual(len(tu.diagnostics[0].fixits), 0) self.assertEqual(len(tu.diagnostics[0].ranges), 1) @@ -97,7 +97,7 @@ def test_diagnostic_children(self): children = d.children self.assertEqual(len(children), 1) self.assertEqual(children[0].severity, Diagnostic.Note) - self.assertRegexpMatches(children[0].spelling, + self.assertRegex(children[0].spelling, '.*declared here') self.assertEqual(children[0].location.line, 1) self.assertEqual(children[0].location.column, 6) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits