summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_iter.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2001-08-17 18:39:25 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2001-08-17 18:39:25 (GMT)
commit339d0f720e86dc34837547c90d3003a4a68d7d46 (patch)
tree2059e5d02f490540e759800b127d50f3fcd8c2b5 /Lib/test/test_iter.py
parentf75976617bb36c892ee8a0f6a6fd3caddbd38cea (diff)
downloadcpython-339d0f720e86dc34837547c90d3003a4a68d7d46.zip
cpython-339d0f720e86dc34837547c90d3003a4a68d7d46.tar.gz
cpython-339d0f720e86dc34837547c90d3003a4a68d7d46.tar.bz2
Patch #445762: Support --disable-unicode
- Do not compile unicodeobject, unicodectype, and unicodedata if Unicode is disabled - check for Py_USING_UNICODE in all places that use Unicode functions - disables unicode literals, and the builtin functions - add the types.StringTypes list - remove Unicode literals from most tests.
Diffstat (limited to 'Lib/test/test_iter.py')
-rw-r--r--Lib/test/test_iter.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/Lib/test/test_iter.py b/Lib/test/test_iter.py
index 63e488e..8b6891b 100644
--- a/Lib/test/test_iter.py
+++ b/Lib/test/test_iter.py
@@ -1,7 +1,7 @@
# Test iterators.
import unittest
-from test_support import run_unittest, TESTFN, unlink
+from test_support import run_unittest, TESTFN, unlink, have_unicode
# Test result of triple loop (too big to inline)
TRIPLETS = [(0, 0, 0), (0, 0, 1), (0, 0, 2),
@@ -214,8 +214,11 @@ class TestCase(unittest.TestCase):
self.check_for_loop(iter("abcde"), ["a", "b", "c", "d", "e"])
# Test a Unicode string
- def test_iter_unicode(self):
- self.check_for_loop(iter(u"abcde"), [u"a", u"b", u"c", u"d", u"e"])
+ if have_unicode:
+ def test_iter_unicode(self):
+ self.check_for_loop(iter(unicode("abcde")),
+ [unicode("a"), unicode("b"), unicode("c"),
+ unicode("d"), unicode("e")])
# Test a directory
def test_iter_dict(self):
@@ -477,6 +480,7 @@ class TestCase(unittest.TestCase):
d = {"one": 1, "two": 2, "three": 3}
self.assertEqual(reduce(add, d), "".join(d.keys()))
+ # This test case will be removed if we don't have Unicode
def test_unicode_join_endcase(self):
# This class inserts a Unicode object into its argument's natural
@@ -493,7 +497,7 @@ class TestCase(unittest.TestCase):
i = self.i
self.i = i+1
if i == 2:
- return u"fooled you!"
+ return unicode("fooled you!")
return self.it.next()
f = open(TESTFN, "w")
@@ -510,13 +514,15 @@ class TestCase(unittest.TestCase):
# and pass that on to unicode.join().
try:
got = " - ".join(OhPhooey(f))
- self.assertEqual(got, u"a\n - b\n - fooled you! - c\n")
+ self.assertEqual(got, unicode("a\n - b\n - fooled you! - c\n"))
finally:
f.close()
try:
unlink(TESTFN)
except OSError:
pass
+ if not have_unicode:
+ def test_unicode_join_endcase(self): pass
# Test iterators with 'x in y' and 'x not in y'.
def test_in_and_not_in(self):