##// END OF EJS Templates
always use StringIO, never cStringIO...
MinRK -
Show More
@@ -0,0 +1,34 b''
1 """Test suite for our color utilities.
2
3 Authors
4 -------
5
6 * Min RK
7 """
8 #-----------------------------------------------------------------------------
9 # Copyright (C) 2011 The IPython Development Team
10 #
11 # Distributed under the terms of the BSD License. The full license is in
12 # the file COPYING.txt, distributed as part of this software.
13 #-----------------------------------------------------------------------------
14
15 #-----------------------------------------------------------------------------
16 # Imports
17 #-----------------------------------------------------------------------------
18
19 # third party
20 import nose.tools as nt
21
22 # our own
23 from IPython.utils.PyColorize import Parser
24
25 #-----------------------------------------------------------------------------
26 # Test functions
27 #-----------------------------------------------------------------------------
28
29 def test_unicode_colorize():
30 p = Parser()
31 f1 = p.format('1/0', 'str')
32 f2 = p.format(u'1/0', 'str')
33 nt.assert_equals(f1, f2)
34
@@ -25,7 +25,7 b' import shutil'
25 25 import re
26 26 import time
27 27 import textwrap
28 from cStringIO import StringIO
28 from StringIO import StringIO
29 29 from getopt import getopt,GetoptError
30 30 from pprint import pformat
31 31 from xmlrpclib import ServerProxy
@@ -20,7 +20,7 b' Authors'
20 20 #-----------------------------------------------------------------------------
21 21 # stdlib
22 22 import unittest
23 from cStringIO import StringIO
23 from StringIO import StringIO
24 24
25 25 from IPython.testing import decorators as dec
26 26 from IPython.utils import io
@@ -12,7 +12,7 b' import os'
12 12 import sys
13 13 import tempfile
14 14 import types
15 from cStringIO import StringIO
15 from StringIO import StringIO
16 16
17 17 import nose.tools as nt
18 18
@@ -7,7 +7,7 b' functionality."""'
7 7 VERBOSE = True
8 8
9 9 # stdlib imports
10 import cStringIO as StringIO
10 import StringIO
11 11 import sys
12 12 import unittest
13 13
@@ -6,7 +6,7 b' Modified from the irunner module but using regex.'
6 6 VERBOSE = True
7 7
8 8 # stdlib imports
9 import cStringIO as StringIO
9 import StringIO
10 10 import sys
11 11 import unittest
12 12 import re
@@ -34,7 +34,7 b" __all__ = ['ANSICodeColors','Parser']"
34 34 _scheme_default = 'Linux'
35 35
36 36 # Imports
37 import cStringIO
37 import StringIO
38 38 import keyword
39 39 import os
40 40 import optparse
@@ -140,13 +140,13 b' class Parser:'
140 140
141 141 string_output = 0
142 142 if out == 'str' or self.out == 'str' or \
143 isinstance(self.out,cStringIO.OutputType):
143 isinstance(self.out,StringIO.StringIO):
144 144 # XXX - I don't really like this state handling logic, but at this
145 145 # point I don't want to make major changes, so adding the
146 146 # isinstance() check is the simplest I can do to ensure correct
147 147 # behavior.
148 148 out_old = self.out
149 self.out = cStringIO.StringIO()
149 self.out = StringIO.StringIO()
150 150 string_output = 1
151 151 elif out is not None:
152 152 self.out = out
@@ -180,7 +180,7 b' class Parser:'
180 180
181 181 # parse the source and write it
182 182 self.pos = 0
183 text = cStringIO.StringIO(self.raw)
183 text = StringIO.StringIO(self.raw)
184 184
185 185 error = False
186 186 try:
@@ -14,7 +14,7 b''
14 14
15 15 import sys
16 16
17 from cStringIO import StringIO
17 from StringIO import StringIO
18 18 from subprocess import Popen, PIPE
19 19
20 20 import nose.tools as nt
General Comments 0
You need to be logged in to leave comments. Login now