def name(self): if self.req is None: return None return native_str(pkg_resources.safe_name(self.req.name))
def test_to_native_str_type(): some_bytes = b"test\xE9 et approuv\xC3\xE9" some_unicode = b"test\xE9 et approuv\xE9".decode('iso-8859-15') assert isinstance(native_str(some_bytes, True), str) assert isinstance(native_str(some_unicode, True), str)