Re: cpython: use assertWarns instead of check_warnings - Issue14341

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: cpython: use assertWarns instead of check_warnings - Issue14341

Georg Brandl-2
On 11.04.2012 17:06, senthil.kumaran wrote:

> http://hg.python.org/cpython/rev/751c7b81f6ee
> changeset:   76241:751c7b81f6ee
> parent:      76232:8a47d2322df0
> user:        Senthil Kumaran<[hidden email]>
> date:        Wed Apr 11 23:05:49 2012 +0800
> summary:
>    use assertWarns instead of check_warnings - Issue14341
>
> files:
>    Lib/test/test_urllib2.py |  16 +++++++++-------
>    1 files changed, 9 insertions(+), 7 deletions(-)
>
>
> diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
> --- a/Lib/test/test_urllib2.py
> +++ b/Lib/test/test_urllib2.py
> @@ -618,21 +618,23 @@
>
>       def test_method_deprecations(self):
>           req = Request("http://www.example.com")
> -        with support.check_warnings(('', DeprecationWarning)):
> +
> +        with self.assertWarns(DeprecationWarning) as cm:
>               req.add_data("data")

There's no need for adding the "as cm" if you don't need the cm object.

Georg

_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%2B1324100855712-1801473%40n6.nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: cpython: use assertWarns instead of check_warnings - Issue14341

Senthil Kumaran-7
On Wed, Apr 11, 2012 at 09:33:30PM +0200, Georg Brandl wrote:
> >+
> >+        with self.assertWarns(DeprecationWarning) as cm:
> >              req.add_data("data")
>
> There's no need for adding the "as cm" if you don't need the cm object.

I overlooked. Thanks for spotting. I have corrected it.

--
Senthil
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%2B1324100855712-1801473%40n6.nabble.com