STINNER Victor <victor.stin...@gmail.com> added the comment:

> 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)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32033>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to