mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
bpo-38371: Tkinter: deprecate the split() method. (GH-16584)
This commit is contained in:
parent
d7c387384a
commit
d05b000c6b
4 changed files with 23 additions and 4 deletions
|
@ -3,6 +3,7 @@ import re
|
|||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
import warnings
|
||||
from test import support
|
||||
|
||||
# Skip this test if the _tkinter module wasn't built.
|
||||
|
@ -573,9 +574,12 @@ class TclTest(unittest.TestCase):
|
|||
def test_split(self):
|
||||
split = self.interp.tk.split
|
||||
call = self.interp.tk.call
|
||||
self.assertRaises(TypeError, split)
|
||||
self.assertRaises(TypeError, split, 'a', 'b')
|
||||
self.assertRaises(TypeError, split, 2)
|
||||
with warnings.catch_warnings():
|
||||
warnings.filterwarnings('ignore', r'\bsplit\b.*\bsplitlist\b',
|
||||
DeprecationWarning)
|
||||
self.assertRaises(TypeError, split)
|
||||
self.assertRaises(TypeError, split, 'a', 'b')
|
||||
self.assertRaises(TypeError, split, 2)
|
||||
testcases = [
|
||||
('2', '2'),
|
||||
('', ''),
|
||||
|
@ -617,7 +621,8 @@ class TclTest(unittest.TestCase):
|
|||
expected),
|
||||
]
|
||||
for arg, res in testcases:
|
||||
self.assertEqual(split(arg), res, msg=arg)
|
||||
with self.assertWarns(DeprecationWarning):
|
||||
self.assertEqual(split(arg), res, msg=arg)
|
||||
|
||||
def test_splitdict(self):
|
||||
splitdict = tkinter._splitdict
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue