[Python-Dev] [Python-checkins] cpython: Issue #11049: adding some tests to test.support

Antoine Pitrou solipsis at pitrou.net
Tue Jul 26 15:30:25 CEST 2011


On Tue, 26 Jul 2011 15:20:55 +0200
Éric Araujo <merwok at netwok.org> wrote:
> > 
> > diff --git a/Lib/test/support.py b/Lib/test/support.py
> > --- a/Lib/test/support.py
> > +++ b/Lib/test/support.py
> > @@ -170,7 +170,7 @@
> >          attribute = getattr(obj, name)
> >      except AttributeError:
> >          raise unittest.SkipTest("module %s has no attribute %s" % (
> > -            obj.__name__, name))
> > +            repr(obj), name))
> 
> I would use %r instead of %s for both fields here.  Non-ASCII characters
> and unseen whitespace are at least two reasons to overuse %r in
> debug/error messages instead of %s.

Actually, you want %a for non-ASCII messages to be escaped.
(however, there's hardly any reason to worry about it when it comes to
stdlib module names)

Regards

Antoine.




More information about the Python-Dev mailing list