[Python-checkins] CVS: python/dist/src/Lib/test pickletester.py,1.6,1.7 string_tests.py,1.9,1.10 test_b1.py,1.37,1.38 test_contains.py,1.7,1.8 test_format.py,1.11,1.12 test_iter.py,1.17,1.18 test_pprint.py,1.4,1.5 test_sre.py,1.26,1.27 test_support.py,1.24,1.25 test_winreg.py,1.9,1.10

Martin v. L?wis loewis@users.sourceforge.net
Fri, 17 Aug 2001 11:39:27 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv28889/Lib/test

Modified Files:
	pickletester.py string_tests.py test_b1.py test_contains.py 
	test_format.py test_iter.py test_pprint.py test_sre.py 
	test_support.py test_winreg.py 
Log Message:
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.


Index: pickletester.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/pickletester.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** pickletester.py	2001/04/16 00:28:21	1.6
--- pickletester.py	2001/08/17 18:39:24	1.7
***************
*** 1,5 ****
  # test_pickle and test_cpickle both use this.
  
! from test_support import TestFailed
  import sys
  
--- 1,5 ----
  # test_pickle and test_cpickle both use this.
  
! from test_support import TestFailed, have_unicode
  import sys
  
***************
*** 192,196 ****
  
      # Test some Unicode end cases
!     endcases = [u'', u'<\\u>', u'<\\\u1234>', u'<\n>',  u'<\\>']
      for u in endcases:
          try:
--- 192,200 ----
  
      # Test some Unicode end cases
!     if have_unicode:
!         endcases = [unicode(''), unicode('<\\u>'), unicode('<\\\u1234>'),
!                     unicode('<\n>'),  unicode('<\\>')]
!     else:
!         endcases = []
      for u in endcases:
          try:

Index: string_tests.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** string_tests.py	2001/05/15 11:58:06	1.9
--- string_tests.py	2001/08/17 18:39:24	1.10
***************
*** 2,6 ****
  
  import string
! from test_support import verify, verbose, TestFailed
  
  transtable = '\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`xyzdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377'
--- 2,6 ----
  
  import string
! from test_support import verify, verbose, TestFailed, have_unicode
  
  transtable = '\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`xyzdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377'
***************
*** 126,134 ****
      test('join', 'a', 'abc', ('abc',))
      test('join', 'a', 'z', UserList(['z']))
!     test('join', u'.', u'a.b.c', ['a', 'b', 'c'])
!     test('join', '.', u'a.b.c', [u'a', 'b', 'c'])
!     test('join', '.', u'a.b.c', ['a', u'b', 'c'])
!     test('join', '.', u'a.b.c', ['a', 'b', u'c'])
!     test('join', '.', TypeError, ['a', u'b', 3])
      for i in [5, 25, 125]:
          test('join', '-', ((('a' * i) + '-') * i)[:-1],
--- 126,135 ----
      test('join', 'a', 'abc', ('abc',))
      test('join', 'a', 'z', UserList(['z']))
!     if have_unicode:
!         test('join', unicode('.'), unicode('a.b.c'), ['a', 'b', 'c'])
!         test('join', '.', unicode('a.b.c'), [unicode('a'), 'b', 'c'])
!         test('join', '.', unicode('a.b.c'), ['a', unicode('b'), 'c'])
!         test('join', '.', unicode('a.b.c'), ['a', 'b', unicode('c')])
!         test('join', '.', TypeError, ['a', unicode('b'), 3])
      for i in [5, 25, 125]:
          test('join', '-', ((('a' * i) + '-') * i)[:-1],

Index: test_b1.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** test_b1.py	2001/07/30 22:49:11	1.37
--- test_b1.py	2001/08/17 18:39:24	1.38
***************
*** 120,124 ****
  if complex(0.0, 3.14) != 3.14j: raise TestFailed, 'complex(0.0, 3.14)'
  if complex("  3.14+J  ") != 3.14+1j:  raise TestFailed, 'complex("  3.14+J  )"'
! if complex(u"  3.14+J  ") != 3.14+1j:  raise TestFailed, 'complex(u"  3.14+J  )"'
  class Z:
      def __complex__(self): return 3.14j
--- 120,126 ----
  if complex(0.0, 3.14) != 3.14j: raise TestFailed, 'complex(0.0, 3.14)'
  if complex("  3.14+J  ") != 3.14+1j:  raise TestFailed, 'complex("  3.14+J  )"'
! if have_unicode:
!     if complex(unicode("  3.14+J  ")) != 3.14+1j:
!         raise TestFailed, 'complex(u"  3.14+J  )"'
  class Z:
      def __complex__(self): return 3.14j
***************
*** 175,190 ****
  if eval('c', globals, locals) != 300:
      raise TestFailed, "eval(4)"
! if eval(u'1+1') != 2: raise TestFailed, 'eval(u\'1+1\')'
! if eval(u' 1+1\n') != 2: raise TestFailed, 'eval(u\' 1+1\\n\')'
  globals = {'a': 1, 'b': 2}
  locals = {'b': 200, 'c': 300}
! if eval(u'a', globals) != 1:
!     raise TestFailed, "eval(1) == %s" % eval(u'a', globals)
! if eval(u'a', globals, locals) != 1:
!     raise TestFailed, "eval(2)"
! if eval(u'b', globals, locals) != 200:
!     raise TestFailed, "eval(3)"
! if eval(u'c', globals, locals) != 300:
!     raise TestFailed, "eval(4)"
  
  print 'execfile'
--- 177,194 ----
  if eval('c', globals, locals) != 300:
      raise TestFailed, "eval(4)"
! if have_unicode:
!     if eval(unicode('1+1')) != 2: raise TestFailed, 'eval(u\'1+1\')'
!     if eval(unicode(' 1+1\n')) != 2: raise TestFailed, 'eval(u\' 1+1\\n\')'
  globals = {'a': 1, 'b': 2}
  locals = {'b': 200, 'c': 300}
! if have_unicode:
!     if eval(unicode('a'), globals) != 1:
!         raise TestFailed, "eval(1) == %s" % eval(unicode('a'), globals)
!     if eval(unicode('a'), globals, locals) != 1:
!         raise TestFailed, "eval(2)"
!     if eval(unicode('b'), globals, locals) != 200:
!         raise TestFailed, "eval(3)"
!     if eval(unicode('c'), globals, locals) != 300:
!         raise TestFailed, "eval(4)"
  
  print 'execfile'
***************
*** 250,256 ****
  if float(314L) != 314.0: raise TestFailed, 'float(314L)'
  if float("  3.14  ") != 3.14:  raise TestFailed, 'float("  3.14  ")'
! if float(u"  3.14  ") != 3.14:  raise TestFailed, 'float(u"  3.14  ")'
! if float(u"  \u0663.\u0661\u0664  ") != 3.14:
!     raise TestFailed, 'float(u"  \u0663.\u0661\u0664  ")'
  
  print 'getattr'
--- 254,262 ----
  if float(314L) != 314.0: raise TestFailed, 'float(314L)'
  if float("  3.14  ") != 3.14:  raise TestFailed, 'float("  3.14  ")'
! if have_unicode:
!     if float(unicode("  3.14  ")) != 3.14:
!         raise TestFailed, 'float(u"  3.14  ")'
!     if float(unicode("  \u0663.\u0661\u0664  ")) != 3.14:
!         raise TestFailed, 'float(u"  \u0663.\u0661\u0664  ")'
  
  print 'getattr'
***************
*** 325,329 ****
  # Different base:
  if int("10",16) != 16L: raise TestFailed, 'int("10",16)'
! if int(u"10",16) != 16L: raise TestFailed, 'int(u"10",16)'
  # Test conversion from strings and various anomalies
  L = [
--- 331,337 ----
  # Different base:
  if int("10",16) != 16L: raise TestFailed, 'int("10",16)'
! if have_unicode:
!     if int(unicode("10"),16) != 16L:
!         raise TestFailed, 'int(u"10",16)'
  # Test conversion from strings and various anomalies
  L = [
***************
*** 344,364 ****
          ('', ValueError),
          (' ', ValueError),
!         ('  \t\t  ', ValueError),
!         (u'0', 0),
!         (u'1', 1),
!         (u'9', 9),
!         (u'10', 10),
!         (u'99', 99),
!         (u'100', 100),
!         (u'314', 314),
!         (u' 314', 314),
!         (u'\u0663\u0661\u0664 ', 314),
!         (u'  \t\t  314  \t\t  ', 314),
!         (u'  1x', ValueError),
!         (u'  1  ', 1),
!         (u'  1\02  ', ValueError),
!         (u'', ValueError),
!         (u' ', ValueError),
!         (u'  \t\t  ', ValueError),
  ]
  for s, v in L:
--- 352,375 ----
          ('', ValueError),
          (' ', ValueError),
!         ('  \t\t  ', ValueError)
! ]
! if have_unicode:
!     L += [
!         (unicode('0'), 0),
!         (unicode('1'), 1),
!         (unicode('9'), 9),
!         (unicode('10'), 10),
!         (unicode('99'), 99),
!         (unicode('100'), 100),
!         (unicode('314'), 314),
!         (unicode(' 314'), 314),
!         (unicode('\u0663\u0661\u0664 '), 314),
!         (unicode('  \t\t  314  \t\t  '), 314),
!         (unicode('  1x'), ValueError),
!         (unicode('  1  '), 1),
!         (unicode('  1\02  '), ValueError),
!         (unicode(''), ValueError),
!         (unicode(' '), ValueError),
!         (unicode('  \t\t  '), ValueError),
  ]
  for s, v in L:
***************
*** 461,474 ****
  if long(-3.5) != -3L: raise TestFailed, 'long(-3.5)'
  if long("-3") != -3L: raise TestFailed, 'long("-3")'
! if long(u"-3") != -3L: raise TestFailed, 'long(u"-3")'
  # Different base:
  if long("10",16) != 16L: raise TestFailed, 'long("10",16)'
! if long(u"10",16) != 16L: raise TestFailed, 'long(u"10",16)'
  # Check conversions from string (same test set as for int(), and then some)
  LL = [
          ('1' + '0'*20, 10L**20),
!         ('1' + '0'*100, 10L**100),
!         (u'1' + u'0'*20, 10L**20),
!         (u'1' + u'0'*100, 10L**100),
  ]
  for s, v in L + LL:
--- 472,492 ----
  if long(-3.5) != -3L: raise TestFailed, 'long(-3.5)'
  if long("-3") != -3L: raise TestFailed, 'long("-3")'
! if have_unicode:
!     if long(unicode("-3")) != -3L:
!         raise TestFailed, 'long(u"-3")'
  # Different base:
  if long("10",16) != 16L: raise TestFailed, 'long("10",16)'
! if have_unicode:
!     if long(unicode("10"),16) != 16L:
!         raise TestFailed, 'long(u"10",16)'
  # Check conversions from string (same test set as for int(), and then some)
  LL = [
          ('1' + '0'*20, 10L**20),
!         ('1' + '0'*100, 10L**100)
! ]
! if have_unicode:
!     L+=[
!         (unicode('1') + unicode('0')*20, 10L**20),
!         (unicode('1') + unicode('0')*100, 10L**100),
  ]
  for s, v in L + LL:

Index: test_contains.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_contains.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** test_contains.py	2001/05/05 10:06:14	1.7
--- test_contains.py	2001/08/17 18:39:24	1.8
***************
*** 1,3 ****
! from test_support import TestFailed
  
  class base_set:
--- 1,3 ----
! from test_support import TestFailed, have_unicode
  
  class base_set:
***************
*** 64,123 ****
      pass
  
- # Test char in Unicode
  
! check('c' in u'abc', "'c' not in u'abc'")
! check('d' not in u'abc', "'d' in u'abc'")
  
! try:
!     '' in u'abc'
!     check(0, "'' in u'abc' did not raise error")
! except TypeError:
!     pass
  
! try:
!     'ab' in u'abc'
!     check(0, "'ab' in u'abc' did not raise error")
! except TypeError:
!     pass
  
! try:
!     None in u'abc'
!     check(0, "None in u'abc' did not raise error")
! except TypeError:
!     pass
  
! # Test Unicode char in Unicode
  
! check(u'c' in u'abc', "u'c' not in u'abc'")
! check(u'd' not in u'abc', "u'd' in u'abc'")
  
! try:
!     u'' in u'abc'
!     check(0, "u'' in u'abc' did not raise error")
! except TypeError:
!     pass
  
! try:
!     u'ab' in u'abc'
!     check(0, "u'ab' in u'abc' did not raise error")
! except TypeError:
!     pass
  
! # Test Unicode char in string
  
! check(u'c' in 'abc', "u'c' not in 'abc'")
! check(u'd' not in 'abc', "u'd' in 'abc'")
  
! try:
!     u'' in 'abc'
!     check(0, "u'' in 'abc' did not raise error")
! except TypeError:
!     pass
  
! try:
!     u'ab' in 'abc'
!     check(0, "u'ab' in 'abc' did not raise error")
! except TypeError:
!     pass
  
  # A collection of tests on builtin sequence types
--- 64,126 ----
      pass
  
  
! if have_unicode:
  
!     # Test char in Unicode
  
!     check('c' in unicode('abc'), "'c' not in u'abc'")
!     check('d' not in unicode('abc'), "'d' in u'abc'")
  
!     try:
!         '' in unicode('abc')
!         check(0, "'' in u'abc' did not raise error")
!     except TypeError:
!         pass
  
!     try:
!         'ab' in unicode('abc')
!         check(0, "'ab' in u'abc' did not raise error")
!     except TypeError:
!         pass
  
!     try:
!         None in unicode('abc')
!         check(0, "None in u'abc' did not raise error")
!     except TypeError:
!         pass
  
!     # Test Unicode char in Unicode
  
!     check(unicode('c') in unicode('abc'), "u'c' not in u'abc'")
!     check(unicode('d') not in unicode('abc'), "u'd' in u'abc'")
  
!     try:
!         unicode('') in unicode('abc')
!         check(0, "u'' in u'abc' did not raise error")
!     except TypeError:
!         pass
  
!     try:
!         unicode('ab') in unicode('abc')
!         check(0, "u'ab' in u'abc' did not raise error")
!     except TypeError:
!         pass
  
!     # Test Unicode char in string
  
!     check(unicode('c') in 'abc', "u'c' not in 'abc'")
!     check(unicode('d') not in 'abc', "u'd' in 'abc'")
! 
!     try:
!         unicode('') in 'abc'
!         check(0, "u'' in 'abc' did not raise error")
!     except TypeError:
!         pass
! 
!     try:
!         unicode('ab') in 'abc'
!         check(0, "u'ab' in 'abc' did not raise error")
!     except TypeError:
!         pass
  
  # A collection of tests on builtin sequence types

Index: test_format.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_format.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** test_format.py	2001/04/12 18:38:48	1.11
--- test_format.py	2001/08/17 18:39:24	1.12
***************
*** 1,3 ****
! from test_support import verbose
  import sys
  
--- 1,3 ----
! from test_support import verbose, have_unicode
  import sys
  
***************
*** 35,39 ****
  def testboth(formatstr, *args):
      testformat(formatstr, *args)
!     testformat(unicode(formatstr), *args)
  
  
--- 35,40 ----
  def testboth(formatstr, *args):
      testformat(formatstr, *args)
!     if have_unicode:
!         testformat(unicode(formatstr), *args)
  
  
***************
*** 213,216 ****
  test_exc('abc %a', 1, ValueError,
           "unsupported format character 'a' (0x61) at index 5")
! test_exc(u'abc %\u3000', 1, ValueError,
!          "unsupported format character '?' (0x3000) at index 5")
--- 214,218 ----
  test_exc('abc %a', 1, ValueError,
           "unsupported format character 'a' (0x61) at index 5")
! if have_unicode:
!     test_exc(unicode('abc %\u3000'), 1, ValueError,
!              "unsupported format character '?' (0x3000) at index 5")

Index: test_iter.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iter.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** test_iter.py	2001/06/21 02:49:54	1.17
--- test_iter.py	2001/08/17 18:39:24	1.18
***************
*** 2,6 ****
  
  import unittest
! from test_support import run_unittest, TESTFN, unlink
  
  # Test result of triple loop (too big to inline)
--- 2,6 ----
  
  import unittest
! from test_support import run_unittest, TESTFN, unlink, have_unicode
  
  # Test result of triple loop (too big to inline)
***************
*** 215,220 ****
  
      # 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"])
  
      # Test a directory
--- 215,223 ----
  
      # Test a Unicode string
!     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
***************
*** 478,481 ****
--- 481,485 ----
          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):
  
***************
*** 494,498 ****
                  self.i = i+1
                  if i == 2:
!                     return u"fooled you!"
                  return self.it.next()
  
--- 498,502 ----
                  self.i = i+1
                  if i == 2:
!                     return unicode("fooled you!")
                  return self.it.next()
  
***************
*** 511,515 ****
          try:
              got = " - ".join(OhPhooey(f))
!             self.assertEqual(got, u"a\n - b\n - fooled you! - c\n")
          finally:
              f.close()
--- 515,519 ----
          try:
              got = " - ".join(OhPhooey(f))
!             self.assertEqual(got, unicode("a\n - b\n - fooled you! - c\n"))
          finally:
              f.close()
***************
*** 518,521 ****
--- 522,527 ----
              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'.

Index: test_pprint.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pprint.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** test_pprint.py	2001/05/14 19:15:23	1.4
--- test_pprint.py	2001/08/17 18:39:24	1.5
***************
*** 4,7 ****
--- 4,12 ----
  import test_support
  
+ try:
+     uni = unicode
+ except NameError:
+     def uni(x):return x
+ 
  
  class QueryTestCase(unittest.TestCase):
***************
*** 15,19 ****
          """Verify .isrecursive() and .isreadable() w/o recursion."""
          verify = self.assert_
!         for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, u"yaddayadda",
                       self.a, self.b):
              verify(not pprint.isrecursive(safe),
--- 20,24 ----
          """Verify .isrecursive() and .isreadable() w/o recursion."""
          verify = self.assert_
!         for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, uni("yaddayadda"),
                       self.a, self.b):
              verify(not pprint.isrecursive(safe),
***************
*** 59,64 ****
          "Simple objects and small containers that should be same as repr()."
          verify = self.assert_
!         for simple in (0, 0L, 0+0j, 0.0, "", u"", (), [], {}, verify, pprint,
!                        -6, -6L, -6-6j, -1.5, "x", u"x", (3,), [3], {3: 6},
                         (1,2), [3,4], {5: 6, 7: 8},
                         {"xy\tab\n": (3,), 5: [[]], (): {}},
--- 64,69 ----
          "Simple objects and small containers that should be same as repr()."
          verify = self.assert_
!         for simple in (0, 0L, 0+0j, 0.0, "", uni(""), (), [], {}, verify, pprint,
!                        -6, -6L, -6-6j, -1.5, "x", uni("x"), (3,), [3], {3: 6},
                         (1,2), [3,4], {5: 6, 7: 8},
                         {"xy\tab\n": (3,), 5: [[]], (): {}},

Index: test_sre.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sre.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** test_sre.py	2001/08/10 14:52:48	1.26
--- test_sre.py	2001/08/17 18:39:24	1.27
***************
*** 7,11 ****
  sys.path=['.']+sys.path
  
! from test_support import verbose, TestFailed
  import sre
  import sys, os, string, traceback
--- 7,11 ----
  sys.path=['.']+sys.path
  
! from test_support import verbose, TestFailed, have_unicode
  import sre
  import sys, os, string, traceback
***************
*** 379,384 ****
              # Try the match with UNICODE locale enabled, and check
              # that it still succeeds.
!             obj=sre.compile(pattern, sre.UNICODE)
!             result=obj.search(s)
!             if result==None:
!                 print '=== Fails on unicode-sensitive match', t
--- 379,385 ----
              # Try the match with UNICODE locale enabled, and check
              # that it still succeeds.
!             if have_unicode:
!                 obj=sre.compile(pattern, sre.UNICODE)
!                 result=obj.search(s)
!                 if result==None:
!                     print '=== Fails on unicode-sensitive match', t

Index: test_support.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** test_support.py	2001/07/16 18:51:32	1.24
--- test_support.py	2001/08/17 18:39:24	1.25
***************
*** 57,60 ****
--- 57,66 ----
      return cmp(x, y)
  
+ try:
+     unicode
+     have_unicode = 1
+ except NameError:
+     have_unicode = 0
+ 
  import os
  # Filename used for testing
***************
*** 65,71 ****
      TESTFN = '@test'
      # Unicode name only used if TEST_FN_ENCODING exists for the platform.
!     TESTFN_UNICODE=u"@test-\xe0\xf2" # 2 latin characters.
!     if os.name=="nt":
!         TESTFN_ENCODING="mbcs"
  else:
      TESTFN = 'test'
--- 71,78 ----
      TESTFN = '@test'
      # Unicode name only used if TEST_FN_ENCODING exists for the platform.
!     if have_unicode:
!         TESTFN_UNICODE=unicode("@test-\xe0\xf2", "latin-1") # 2 latin characters.
!         if os.name=="nt":
!             TESTFN_ENCODING="mbcs"
  else:
      TESTFN = 'test'

Index: test_winreg.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_winreg.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** test_winreg.py	2001/01/17 21:51:36	1.9
--- test_winreg.py	2001/08/17 18:39:24	1.10
***************
*** 5,9 ****
  import os, sys
  
! from test_support import verify
  
  test_key_name = "SOFTWARE\\Python Registry Test Key - Delete Me"
--- 5,9 ----
  import os, sys
  
! from test_support import verify, have_unicode
  
  test_key_name = "SOFTWARE\\Python Registry Test Key - Delete Me"
***************
*** 12,23 ****
      ("Int Value",     45,                                      REG_DWORD),
      ("String Val",    "A string value",                        REG_SZ,),
-     (u"Unicode Val",  u"A Unicode value",                      REG_SZ,),
      ("StringExpand",  "The path is %path%",                    REG_EXPAND_SZ),
-     ("UnicodeExpand", u"The path is %path%",                   REG_EXPAND_SZ),
      ("Multi-string",  ["Lots", "of", "string", "values"],      REG_MULTI_SZ),
-     ("Multi-unicode", [u"Lots", u"of", u"unicode", u"values"], REG_MULTI_SZ),
-     ("Multi-mixed",   [u"Unicode", u"and", "string", "values"],REG_MULTI_SZ),
      ("Raw Data",      ("binary"+chr(0)+"data"),                REG_BINARY),
  ]
  
  def WriteTestData(root_key):
--- 12,26 ----
      ("Int Value",     45,                                      REG_DWORD),
      ("String Val",    "A string value",                        REG_SZ,),
      ("StringExpand",  "The path is %path%",                    REG_EXPAND_SZ),
      ("Multi-string",  ["Lots", "of", "string", "values"],      REG_MULTI_SZ),
      ("Raw Data",      ("binary"+chr(0)+"data"),                REG_BINARY),
  ]
+ if have_unicode:
+     test_data+=[
+     (unicode("Unicode Val"),  unicode("A Unicode value"),                      REG_SZ,),
+     ("UnicodeExpand", unicode("The path is %path%"),                   REG_EXPAND_SZ),
+     ("Multi-unicode", [unicode("Lots"), unicode("of"), unicode("unicode"), unicode("values")], REG_MULTI_SZ),
+     ("Multi-mixed",   [unicode("Unicode"), unicode("and"), "string", "values"],REG_MULTI_SZ),
+     ]
  
  def WriteTestData(root_key):