always use StringIO, never cStringIO #783

Merged
merged 1 commit into from Sep 12, 2011
View
@@ -25,7 +25,7 @@
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
@@ -20,7 +20,7 @@
#-----------------------------------------------------------------------------
# stdlib
import unittest
-from cStringIO import StringIO
+from StringIO import StringIO
from IPython.testing import decorators as dec
from IPython.utils import io
@@ -12,7 +12,7 @@
import sys
import tempfile
import types
-from cStringIO import StringIO
+from StringIO import StringIO
import nose.tools as nt
@@ -7,7 +7,7 @@
VERBOSE = True
# stdlib imports
-import cStringIO as StringIO
+import StringIO
import sys
import unittest
@@ -6,7 +6,7 @@
VERBOSE = True
# stdlib imports
-import cStringIO as StringIO
+import StringIO
import sys
import unittest
import re
@@ -34,7 +34,7 @@
_scheme_default = 'Linux'
# Imports
-import cStringIO
+import StringIO
import keyword
import os
import optparse
@@ -140,13 +140,13 @@ def format2(self, raw, out = None, scheme = ''):
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 @@ def format2(self, raw, out = None, scheme = ''):
# parse the source and write it
self.pos = 0
- text = cStringIO.StringIO(self.raw)
+ text = StringIO.StringIO(self.raw)
error = False
try:
@@ -14,7 +14,7 @@
import sys
-from cStringIO import StringIO
+from StringIO import StringIO
from subprocess import Popen, PIPE
import nose.tools as nt
@@ -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)
+