diff --git a/IPython/core/magic.py b/IPython/core/magic.py index 751dedb..e33d344 100644 --- a/IPython/core/magic.py +++ b/IPython/core/magic.py @@ -25,7 +25,7 @@ import shutil import re import time import textwrap -from cStringIO import StringIO +from StringIO import StringIO from getopt import getopt,GetoptError from pprint import pformat from xmlrpclib import ServerProxy diff --git a/IPython/core/tests/test_interactiveshell.py b/IPython/core/tests/test_interactiveshell.py index 29dc92d..a256cff 100644 --- a/IPython/core/tests/test_interactiveshell.py +++ b/IPython/core/tests/test_interactiveshell.py @@ -20,7 +20,7 @@ Authors #----------------------------------------------------------------------------- # stdlib import unittest -from cStringIO import StringIO +from StringIO import StringIO from IPython.testing import decorators as dec from IPython.utils import io diff --git a/IPython/core/tests/test_magic.py b/IPython/core/tests/test_magic.py index cb141bb..5b9f6b6 100644 --- a/IPython/core/tests/test_magic.py +++ b/IPython/core/tests/test_magic.py @@ -12,7 +12,7 @@ import os import sys import tempfile import types -from cStringIO import StringIO +from StringIO import StringIO import nose.tools as nt diff --git a/IPython/lib/tests/test_irunner.py b/IPython/lib/tests/test_irunner.py index 2827c3f..642938b 100755 --- a/IPython/lib/tests/test_irunner.py +++ b/IPython/lib/tests/test_irunner.py @@ -7,7 +7,7 @@ functionality.""" VERBOSE = True # stdlib imports -import cStringIO as StringIO +import StringIO import sys import unittest diff --git a/IPython/lib/tests/test_irunner_pylab_magic.py b/IPython/lib/tests/test_irunner_pylab_magic.py index b7c5c2f..71292a7 100644 --- a/IPython/lib/tests/test_irunner_pylab_magic.py +++ b/IPython/lib/tests/test_irunner_pylab_magic.py @@ -6,7 +6,7 @@ Modified from the irunner module but using regex. VERBOSE = True # stdlib imports -import cStringIO as StringIO +import StringIO import sys import unittest import re diff --git a/IPython/utils/PyColorize.py b/IPython/utils/PyColorize.py index bf3e1ba..ffe3561 100644 --- a/IPython/utils/PyColorize.py +++ b/IPython/utils/PyColorize.py @@ -34,7 +34,7 @@ __all__ = ['ANSICodeColors','Parser'] _scheme_default = 'Linux' # Imports -import cStringIO +import StringIO import keyword import os import optparse @@ -140,13 +140,13 @@ class Parser: string_output = 0 if out == 'str' or self.out == 'str' or \ - isinstance(self.out,cStringIO.OutputType): + isinstance(self.out,StringIO.StringIO): # XXX - I don't really like this state handling logic, but at this # point I don't want to make major changes, so adding the # isinstance() check is the simplest I can do to ensure correct # behavior. out_old = self.out - self.out = cStringIO.StringIO() + self.out = StringIO.StringIO() string_output = 1 elif out is not None: self.out = out @@ -180,7 +180,7 @@ class Parser: # parse the source and write it self.pos = 0 - text = cStringIO.StringIO(self.raw) + text = StringIO.StringIO(self.raw) error = False try: diff --git a/IPython/utils/tests/test_io.py b/IPython/utils/tests/test_io.py index 59fdfc5..64764a4 100644 --- a/IPython/utils/tests/test_io.py +++ b/IPython/utils/tests/test_io.py @@ -14,7 +14,7 @@ import sys -from cStringIO import StringIO +from StringIO import StringIO from subprocess import Popen, PIPE import nose.tools as nt diff --git a/IPython/utils/tests/test_pycolorize.py b/IPython/utils/tests/test_pycolorize.py new file mode 100644 index 0000000..8ee849c --- /dev/null +++ b/IPython/utils/tests/test_pycolorize.py @@ -0,0 +1,34 @@ +"""Test suite for our color utilities. + +Authors +------- + +* Min RK +""" +#----------------------------------------------------------------------------- +# Copyright (C) 2011 The IPython Development Team +# +# Distributed under the terms of the BSD License. The full license is in +# the file COPYING.txt, distributed as part of this software. +#----------------------------------------------------------------------------- + +#----------------------------------------------------------------------------- +# Imports +#----------------------------------------------------------------------------- + +# third party +import nose.tools as nt + +# our own +from IPython.utils.PyColorize import Parser + +#----------------------------------------------------------------------------- +# Test functions +#----------------------------------------------------------------------------- + +def test_unicode_colorize(): + p = Parser() + f1 = p.format('1/0', 'str') + f2 = p.format(u'1/0', 'str') + nt.assert_equals(f1, f2) +