mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-33262: Deprecate passing None for s
to shlex.split() (GH-6514)
* bpo-33262: Deprecate passing None for `s` to shlex.split() This reads the string to split from standard input. * Update What's New. * Fix shlex.rst
This commit is contained in:
parent
7c72383f95
commit
975ac326ff
5 changed files with 18 additions and 1 deletions
|
@ -3,7 +3,7 @@ import itertools
|
|||
import shlex
|
||||
import string
|
||||
import unittest
|
||||
|
||||
from unittest import mock
|
||||
|
||||
|
||||
# The original test data set was from shellwords, by Hartmut Goebel.
|
||||
|
@ -162,6 +162,11 @@ class ShlexTest(unittest.TestCase):
|
|||
tok = lex.get_token()
|
||||
return ret
|
||||
|
||||
@mock.patch('sys.stdin', io.StringIO())
|
||||
def testSplitNoneDeprecation(self):
|
||||
with self.assertWarns(DeprecationWarning):
|
||||
shlex.split(None)
|
||||
|
||||
def testSplitPosix(self):
|
||||
"""Test data splitting with posix parser"""
|
||||
self.splitTest(self.posix_data, comments=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue