zope.proxy does not proxy __unicode__
Bug #1262702 reported by
Marius Gedminas
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
zope.proxy |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
See the failing tests I committed in a branch:
https:/
I'm not sure how to fix this. It appears that CPython's PyTypeObject doesn't have a tp_unicode slot. Can anyone with more C API experience chime in? How would you define a C class with a custom __unicode__ representation?
To post a comment you must log in.
FWIW here's what the test failures look like:
mg@platonas: ~/src/new- zope-order/ zope.proxy [git:master *$=] $ bin/test -pvc .layer. UnitTests tests: .layer. UnitTests in 0.000 seconds. unicode_ _of_custom_ class (zope.proxy. tests.test_ proxy.ProxyBase TestCase)
Running tests at level 1
Running zope.testrunner
Set up zope.testrunner
Running:
83/151 (55.0%) test___
Failure in test test___ unicode_ _of_custom_ class (zope.proxy. tests.test_ proxy.ProxyBase TestCase) python2. 7/unittest/ case.py" , line 331, in run mg/src/ new-zope- order/zope. proxy/src/ zope/proxy/ tests/test_ proxy.py" , line 127, in test___ unicode_ _of_custom_ class assertEqual( unicode( proxy), u'Hello, \u2603') python2. 7/unittest/ case.py" , line 515, in assertEqual func(first, second, msg=msg) python2. 7/unittest/ case.py" , line 926, in assertMultiLine Equal fail(self. _formatMessage( msg, standardMsg)) python2. 7/unittest/ case.py" , line 412, in fail eption( msg) proxy.tests. test_proxy. CustomClass object at 0x2d42e10>' != u'Hello, \u2603' tests.test_ proxy.CustomCla ss object at 0x2d42e10>
Traceback (most recent call last):
File "/usr/lib/
testMethod()
File "/home/
self.
File "/usr/lib/
assertion_
File "/usr/lib/
self.
File "/usr/lib/
raise self.failureExc
AssertionError: u'<zope.
- <zope.proxy.
+ Hello, \u2603
84/151 (55.6%) test___ unicode_ _of_unicode (zope.proxy. tests.test_ proxy.ProxyBase TestCase)
Error in test test___ unicode_ _of_unicode (zope.proxy. tests.test_ proxy.ProxyBase TestCase) python2. 7/unittest/ case.py" , line 331, in run mg/src/ new-zope- order/zope. proxy/src/ zope/proxy/ tests/test_ proxy.py" , line 117, in test___ unicode_ _of_unicode assertEqual( unicode( proxy), s)
Traceback (most recent call last):
File "/usr/lib/
testMethod()
File "/home/
self.
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2603' in position 7: ordinal not in range(128)
Ran 151 tests with 1 failures, 1 errors, 0 skipped in 0.032 seconds. .layer. UnitTests in 0.000 seconds.
Tearing down left over layers:
Tear down zope.testrunner
Tests with errors: __unicode_ _of_unicode (zope.proxy. tests.test_ proxy.ProxyBase TestCase)
test_
Tests with failures: __unicode_ _of_custom_ class (zope.proxy. tests.test_ proxy.ProxyBase TestCase)
test_
[exited with 1]