[Python-3000-checkins] r56313 - python/branches/py3k-struni/Lib/ctypes/test/test_objects.py
Thomas Heller
theller at ctypes.org
Thu Jul 12 15:38:31 CEST 2007
Guido van Rossum schrieb:
> On 7/12/07, thomas.heller <python-3000-checkins at python.org> wrote:
>> Author: thomas.heller
>> Date: Thu Jul 12 13:59:52 2007
>> New Revision: 56313
>>
>> Modified:
>> python/branches/py3k-struni/Lib/ctypes/test/test_objects.py
>> Log:
>> Fix a ctypes test.
>>
>> Modified: python/branches/py3k-struni/Lib/ctypes/test/test_objects.py
>> ==============================================================================
>> --- python/branches/py3k-struni/Lib/ctypes/test/test_objects.py (original)
>> +++ python/branches/py3k-struni/Lib/ctypes/test/test_objects.py Thu Jul 12 13:59:52 2007
>> @@ -22,9 +22,9 @@
>>
>> >>> array[4] = 'foo bar'
>> >>> array._objects
>> -{'4': 'foo bar'}
>> +{s'4': b'foo bar'}
>> >>> array[4]
>> -'foo bar'
>> +s'foo bar'
>> >>>
>
> FWIW, when tests show s'...', the preferred fix is to change the
> underlying code to return unicode, not to fix the test to accept the
> 8-bit string. This is why we made str8.__repr__ add the 's' prefix: so
> more tests would fail so we'd be alerted to places still returning
> str8 instead of str.
>
Sure.
Generally, these are quick fixes to just fix the tests before I change the semantics
of the ctypes implementation. In this special case, the test is testing the internals
of the ctypes objects, and the I will probably change the code to use bytes instead of
8-bit strings.
Thomas
More information about the Python-3000-checkins
mailing list