Windson Yang <wiwind...@outlook.com> added the comment:

My base idea would be some unittests for the function like:

class ExtendPathBaseTests(unittest.TestCase):
    def test_input_string(self):
        path = 'path'
        name = 'foo'
        self.assertEqual('path', pkgutil.extend_path(path, name))

    def test_parent_package_raise_key_error(self):
        path = ['path']
        # sys.modules['foo'] raise KeyError
        name = 'foo.bar'
        self.assertEqual(['path'], pkgutil.extend_path(path, name))

    def test_parent_package_raise_attr_error(self):
        path = ['path']
        # datetime module don't have __path__ attr
        name = 'datetime.date'
        self.assertEqual(['path'], pkgutil.extend_path(path, name))

I would move forward if we agreed.

----------

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

Reply via email to