|
3 | 3 | import subprocess |
4 | 4 | import sys |
5 | 5 | import os |
| 6 | +import warnings |
6 | 7 | from test import support |
7 | 8 |
|
8 | 9 | # Skip this test if the _tkinter module wasn't built. |
@@ -573,9 +574,12 @@ def test_splitlist(self): |
573 | 574 | def test_split(self): |
574 | 575 | split = self.interp.tk.split |
575 | 576 | call = self.interp.tk.call |
576 | | - self.assertRaises(TypeError, split) |
577 | | - self.assertRaises(TypeError, split, 'a', 'b') |
578 | | - self.assertRaises(TypeError, split, 2) |
| 577 | + with warnings.catch_warnings(): |
| 578 | + warnings.filterwarnings('ignore', r'\bsplit\b.*\bsplitlist\b', |
| 579 | + DeprecationWarning) |
| 580 | + self.assertRaises(TypeError, split) |
| 581 | + self.assertRaises(TypeError, split, 'a', 'b') |
| 582 | + self.assertRaises(TypeError, split, 2) |
579 | 583 | testcases = [ |
580 | 584 | ('2', '2'), |
581 | 585 | ('', ''), |
@@ -617,7 +621,8 @@ def test_split(self): |
617 | 621 | expected), |
618 | 622 | ] |
619 | 623 | for arg, res in testcases: |
620 | | - self.assertEqual(split(arg), res, msg=arg) |
| 624 | + with self.assertWarns(DeprecationWarning): |
| 625 | + self.assertEqual(split(arg), res, msg=arg) |
621 | 626 |
|
622 | 627 | def test_splitdict(self): |
623 | 628 | splitdict = tkinter._splitdict |
|
0 commit comments