[issue11887] unittest fails on comparing str with bytes if python has the -bb option

2011-05-06 Thread Michael Foord
Michael Foord added the comment: _baseAssertEqual should not unconditionally catch and ignore all BytesWarnings. If tests raise warnings/exceptions because they are doing comparisons that raise warnings/exceptions then those tests should be fixed rather than just ignoring the warnings. -

[issue11887] unittest fails on comparing str with bytes if python has the -bb option

2011-05-02 Thread Nick Coghlan
Nick Coghlan added the comment: I'm OK with that - I'd actually suggest explicitly *emitting* a warning when the error is suppressed under -bb, as Ezio is right that even tests should be keeping their bytes/str separation straight. I don't like completely suppressing warnings/errors when a us

[issue11887] unittest fails on comparing str with bytes if python has the -bb option

2011-05-02 Thread STINNER Victor
STINNER Victor added the comment: > Rather than fiddling with the warnings filters, wouldn't it be easier > to just catch BytesWarning and return False in that case? It's another possible solution, but it would display a warning using python -b. --

[issue11887] unittest fails on comparing str with bytes if python has the -bb option

2011-05-02 Thread Nick Coghlan
Nick Coghlan added the comment: Rather than fiddling with the warnings filters, wouldn't it be easier to just catch BytesWarning and return False in that case? -- nosy: +ncoghlan ___ Python tracker __

[issue11887] unittest fails on comparing str with bytes if python has the -bb option

2011-05-02 Thread Ezio Melotti
Ezio Melotti added the comment: > I think that the patch is simple (it adds 3 "with+simplefilter") and it > doesn't add "complexity", or you should define what complexity is :-) The patch is indeed quite simple. but with it half of the code in _baseAssertEqual will be to deal with warnings for

[issue11887] unittest fails on comparing str with bytes if python has the -bb option

2011-05-02 Thread STINNER Victor
STINNER Victor added the comment: Le lundi 02 mai 2011 07:05:28, vous avez écrit : > * the patch introduces code/complexity in _baseAssertEqual and other > places, using catch_warnings to change and restore the warning filters at > every call; Yes, and what is the problem? I think that it is

[issue11887] unittest fails on comparing str with bytes if python has the -bb option

2011-05-01 Thread Ezio Melotti
Ezio Melotti added the comment: I thought some more about this and I'm -0.5. The reasons are: * the patch introduces code/complexity in _baseAssertEqual and other places, using catch_warnings to change and restore the warning filters at every call; * this is needed only when Python is run w

[issue11887] unittest fails on comparing str with bytes if python has the -bb option

2011-04-30 Thread STINNER Victor
STINNER Victor added the comment: unittest_str_bytes-2.patch: - add new tests to reproduce the bug - fix the bug: ignore temporary BytesWarning warnings while comparing objects and sequences -- Added file: http://bugs.python.org/file21844/unittest_str_bytes-2.patch _

[issue11887] unittest fails on comparing str with bytes if python has the -bb option

2011-04-29 Thread Michael Foord
Changes by Michael Foord : -- nosy: +michael.foord ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.

[issue11887] unittest fails on comparing str with bytes if python has the -bb option

2011-04-20 Thread STINNER Victor
Changes by STINNER Victor : -- keywords: +patch Added file: http://bugs.python.org/file21740/unittest_str_bytes.patch ___ Python tracker ___ _

[issue11887] unittest fails on comparing str with bytes if python has the -bb option

2011-04-20 Thread STINNER Victor
New submission from STINNER Victor : assertEqual(), assertListEqual(), assertSequenceEqual() emits a BytesWarning warning or raise a BytesWarning exception if python has -b or -bb option. Attached patch adds tests to demonstrate this issue. -- components: Library (Lib), Tests, Unicode