Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19138
| From | Jabba Laci <jabba.laci@gmail.com> |
|---|---|
| Date | 2012-01-19 21:45 +0100 |
| Subject | verify the return value of a function |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4872.1327005963.27778.python-list@python.org> (permalink) |
Hi, In a unit test, I want to verify that a function returns a cookielib.LWPCookieJar object. What is the correct way of doing that? 1) First I tried to figure out its type with type(return_value) but it is <type 'instance'> 2) return_value.__class__ .__name__ gives 'LWPCookieJar', which is bettter 3) isinstance(return_value, cookielib.LWPCookieJar) seems to be the best way, however somewhere I read that using isinstance is discouraged Thanks, Laszlo
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
verify the return value of a function Jabba Laci <jabba.laci@gmail.com> - 2012-01-19 21:45 +0100 Re: verify the return value of a function Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-01-20 10:15 +0100 Re: verify the return value of a function Roy Smith <roy@panix.com> - 2012-01-20 09:24 -0500
csiph-web