Message306262
| Author |
vstinner |
| Recipients |
serhiy.storchaka, vstinner, xdegaye |
| Date |
2017年11月15日.10:47:04 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1510742824.13.0.213398074469.issue32033@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> self.assertIsInstance(e.pw_gecos, str)
This test is wrong: it's perfectly fine to get None here.
Python must not test the OS itself, but only test our own code: make sure that Python converts properly C types to nice Python types, so a string or None.
I propose to use something like:
def check_type(field):
self.assertTrue(field is None or isinstance(field, str), repr(field))
...
check_type(e.pw_gecos) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2017年11月15日 10:47:04 | vstinner | set | recipients:
+ vstinner, xdegaye, serhiy.storchaka |
| 2017年11月15日 10:47:04 | vstinner | set | messageid: <1510742824.13.0.213398074469.issue32033@psf.upfronthosting.co.za> |
| 2017年11月15日 10:47:04 | vstinner | link | issue32033 messages |
| 2017年11月15日 10:47:04 | vstinner | create |
|