[Python-checkins] CVS: python/dist/src/Lib/test test_b1.py,1.26,1.27
M.-A. Lemburg
python-dev@python.org
Tue, 19 Sep 2000 13:58:56 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory slayer.i.sourceforge.net:/tmp/cvs-serv15248/Lib/test
Modified Files:
test_b1.py
Log Message:
This patch adds a new Python C API called PyString_AsStringAndSize()
which implements the automatic conversion from Unicode to a string
object using the default encoding.
The new API is then put to use to have eval() and exec accept
Unicode objects as code parameter. This closes bugs #110924
and #113890.
As side-effect, the traditional C APIs PyString_Size() and
PyString_AsString() will also accept Unicode objects as
parameters.
Index: test_b1.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** test_b1.py 2000/09/01 06:53:51 1.26
--- test_b1.py 2000/09/19 20:58:53 1.27
***************
*** 162,165 ****
--- 162,177 ----
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'