mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
Fix test_shlex: Use io.StringIO.
This commit is contained in:
parent
26e0f51280
commit
2c849f2f20
1 changed files with 2 additions and 7 deletions
|
@ -1,15 +1,10 @@
|
||||||
# -*- coding: iso-8859-1 -*-
|
# -*- coding: iso-8859-1 -*-
|
||||||
import unittest
|
import unittest
|
||||||
import os, sys
|
import os, sys, io
|
||||||
import shlex
|
import shlex
|
||||||
|
|
||||||
from test import test_support
|
from test import test_support
|
||||||
|
|
||||||
try:
|
|
||||||
from cStringIO import StringIO
|
|
||||||
except ImportError:
|
|
||||||
from StringIO import StringIO
|
|
||||||
|
|
||||||
|
|
||||||
# The original test data set was from shellwords, by Hartmut Goebel.
|
# The original test data set was from shellwords, by Hartmut Goebel.
|
||||||
|
|
||||||
|
@ -160,7 +155,7 @@ class ShlexTest(unittest.TestCase):
|
||||||
|
|
||||||
def oldSplit(self, s):
|
def oldSplit(self, s):
|
||||||
ret = []
|
ret = []
|
||||||
lex = shlex.shlex(StringIO(s))
|
lex = shlex.shlex(io.StringIO(s))
|
||||||
tok = lex.get_token()
|
tok = lex.get_token()
|
||||||
while tok:
|
while tok:
|
||||||
ret.append(tok)
|
ret.append(tok)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue