mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Update shlex from 3.13.5 (#5977)
This commit is contained in:
9
Lib/shlex.py
vendored
9
Lib/shlex.py
vendored
@@ -305,9 +305,7 @@ class shlex:
|
||||
def split(s, comments=False, posix=True):
|
||||
"""Split the string *s* using shell-like syntax."""
|
||||
if s is None:
|
||||
import warnings
|
||||
warnings.warn("Passing None for 's' to shlex.split() is deprecated.",
|
||||
DeprecationWarning, stacklevel=2)
|
||||
raise ValueError("s argument must not be None")
|
||||
lex = shlex(s, posix=posix)
|
||||
lex.whitespace_split = True
|
||||
if not comments:
|
||||
@@ -335,10 +333,7 @@ def quote(s):
|
||||
|
||||
|
||||
def _print_tokens(lexer):
|
||||
while 1:
|
||||
tt = lexer.get_token()
|
||||
if not tt:
|
||||
break
|
||||
while tt := lexer.get_token():
|
||||
print("Token: " + repr(tt))
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
14
Lib/test/test_shlex.py
vendored
14
Lib/test/test_shlex.py
vendored
@@ -3,7 +3,6 @@ import itertools
|
||||
import shlex
|
||||
import string
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
|
||||
# The original test data set was from shellwords, by Hartmut Goebel.
|
||||
@@ -162,18 +161,17 @@ class ShlexTest(unittest.TestCase):
|
||||
tok = lex.get_token()
|
||||
return ret
|
||||
|
||||
@mock.patch('sys.stdin', io.StringIO())
|
||||
def testSplitNoneDeprecation(self):
|
||||
with self.assertWarns(DeprecationWarning):
|
||||
def testSplitNone(self):
|
||||
with self.assertRaises(ValueError):
|
||||
shlex.split(None)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
# TODO: RUSTPYTHON; ValueError: Error Retrieving Value
|
||||
@unittest.expectedFailure
|
||||
def testSplitPosix(self):
|
||||
"""Test data splitting with posix parser"""
|
||||
self.splitTest(self.posix_data, comments=True)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
# TODO: RUSTPYTHON; ValueError: Error Retrieving Value
|
||||
@unittest.expectedFailure
|
||||
def testCompat(self):
|
||||
"""Test compatibility interface"""
|
||||
@@ -315,7 +313,7 @@ class ShlexTest(unittest.TestCase):
|
||||
s = shlex.shlex("'')abc", punctuation_chars=True)
|
||||
self.assertEqual(list(s), expected)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
# TODO: RUSTPYTHON; ValueError: Error Retrieving Value
|
||||
@unittest.expectedFailure
|
||||
def testUnicodeHandling(self):
|
||||
"""Test punctuation_chars and whitespace_split handle unicode."""
|
||||
@@ -356,7 +354,7 @@ class ShlexTest(unittest.TestCase):
|
||||
joined = shlex.join(split_command)
|
||||
self.assertEqual(joined, command)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
# TODO: RUSTPYTHON; ValueError: Error Retrieving Value
|
||||
@unittest.expectedFailure
|
||||
def testJoinRoundtrip(self):
|
||||
all_data = self.data + self.posix_data
|
||||
|
||||
Reference in New Issue
Block a user