[Python-Dev] Re: [Python-checkins] python/dist/src/Lib/test test_string.py, 1.25, 1.26

Walter Dörwald walter at livinglogic.de
Thu Aug 26 14:47:36 CEST 2004


Nick Coghlan wrote:

> Walter Dörwald wrote:
> 
>> test_string.py is supposed to test the string module. This new test
>> should be moved to test_str.py (or even better to string_test.py,
>> so that it can be reused for doing the same test with unicode objects).
> 
> 
> Ah, I think I see where the tests should have gone 
> (MixinStrUnicodeUserStringTest.test_join in string_test.py).
> 
> I'll work up a patch to bring those tests in sync with the rest of the 
> string tests (the structure of which I find harder to follow than the 
> string code itself. . .). However, I probably won't get to it for a week 
> or so.

I'm working on it, however I discovered that unicode.join()
doesn't optimize this special case:

s = "foo"
assert "".join([s]) is s

u = u"foo"
assert u"".join([s]) is s

The second assertion fails.

I'd say that this test (joining a one item sequence returns
the item itself) should be removed because it tests an
implementation detail.

I'm not sure, whether the optimization should be added to
unicode.find().

Bye,
    Walter Dörwald





More information about the Python-Dev mailing list