[MERGE] Before actually using encoding need to check that Python has corresponding codec (v.4)

Alexander Belchenko bialix at ukr.net
Tue Jan 2 21:57:06 GMT 2007

John Arbash Meinel пишет:
>>> And then in the test cleanup, add fake_codec.reset()
>> As I explain above it's not working.
>> -- 
>> Alexander
> I see your problem... And since lookup() is a C function, it probably
> isn't possible to get easy access to whatever cache it is using.
> So we can go with how it is, and just make it clear what is going on.
> You could change this line:
>    Clients could add new encoding names, but cannot remove it.
> to be
>    Clients can add new encoding names, but because of how codecs is
>    implemented they cannot be removed. Be careful with naming to avoid
>    collisions between tests, and with real encodings.

OK. Changed as you suggested.

I'm also scan with fresh eye over my tests and catch error in test with
cpUNKNOWN. Because during lookup encoding name translated to canonical
form (i.e. to lowercase, and '-' replaced with '_' or even removed), I
catch  incompleteness in self.make_wrapped_streams(). New version of my
patch is attached. I think it's final version.

> We might also want to have a check if we are adding one that we already
> added, we should complain, so that people know to avoid collisions
> between test cases. But I'm not stuck on that if it is useful to re-use
> a fake encoding.

I see that sometimes it useful to re-use a fake encoding, sometimes is
not. I prefer to leave things in current state, because now we have
correct tests.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: check-encoding.v4.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20070102/cf4581f6/attachment.diff 

More information about the bazaar mailing list