✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ server366.web-hosting.com ​🇻​♯➤ 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP 🇾​♯➤ 2025

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 67.223.118.204 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.217.62
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗙𝗙 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ 𝗔𝗟𝗟 𝗪𝗢𝗥𝗞𝗜𝗡𝗚....

𝗛𝗢𝗠𝗘
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /opt/hc_python/lib/python3.12/site-packages/importlib_resources/tests//test_reader.py
import os.path
import pathlib
import unittest
from importlib import import_module

from importlib_resources.readers import MultiplexedPath, NamespaceReader

from . import util


class MultiplexedPathTest(util.DiskSetup, unittest.TestCase):
    MODULE = 'namespacedata01'

    def setUp(self):
        super().setUp()
        self.folder = pathlib.Path(self.data.__path__[0])
        self.data01 = pathlib.Path(self.load_fixture('data01').__file__).parent
        self.data02 = pathlib.Path(self.load_fixture('data02').__file__).parent

    def test_init_no_paths(self):
        with self.assertRaises(FileNotFoundError):
            MultiplexedPath()

    def test_init_file(self):
        with self.assertRaises(NotADirectoryError):
            MultiplexedPath(self.folder / 'binary.file')

    def test_iterdir(self):
        contents = {path.name for path in MultiplexedPath(self.folder).iterdir()}
        try:
            contents.remove('__pycache__')
        except (KeyError, ValueError):
            pass
        assert contents == {'subdirectory', 'binary.file', 'utf-16.file', 'utf-8.file'}

    def test_iterdir_duplicate(self):
        contents = {
            path.name for path in MultiplexedPath(self.folder, self.data01).iterdir()
        }
        for remove in ('__pycache__', '__init__.pyc'):
            try:
                contents.remove(remove)
            except (KeyError, ValueError):
                pass
        assert contents == {
            '__init__.py',
            'binary.file',
            'subdirectory',
            'utf-16.file',
            'utf-8.file',
        }

    def test_is_dir(self):
        assert MultiplexedPath(self.folder).is_dir()

    def test_is_file(self):
        assert not MultiplexedPath(self.folder).is_file()

    def test_open_file(self):
        path = MultiplexedPath(self.folder)
        with self.assertRaises(FileNotFoundError):
            path.read_bytes()
        with self.assertRaises(FileNotFoundError):
            path.read_text()
        with self.assertRaises(FileNotFoundError):
            path.open()

    def test_join_path(self):
        prefix = str(self.folder.parent)
        path = MultiplexedPath(self.folder, self.data01)
        assert str(path.joinpath('binary.file'))[len(prefix) + 1 :] == os.path.join(
            'namespacedata01', 'binary.file'
        )
        sub = path.joinpath('subdirectory')
        assert isinstance(sub, MultiplexedPath)
        assert 'namespacedata01' in str(sub)
        assert 'data01' in str(sub)
        assert str(path.joinpath('imaginary'))[len(prefix) + 1 :] == os.path.join(
            'namespacedata01', 'imaginary'
        )
        assert path.joinpath() == path

    def test_join_path_compound(self):
        path = MultiplexedPath(self.folder)
        assert not path.joinpath('imaginary/foo.py').exists()

    def test_join_path_common_subdir(self):
        prefix = str(self.data02.parent)
        path = MultiplexedPath(self.data01, self.data02)
        assert isinstance(path.joinpath('subdirectory'), MultiplexedPath)
        assert str(path.joinpath('subdirectory', 'subsubdir'))[len(prefix) + 1 :] == (
            os.path.join('data02', 'subdirectory', 'subsubdir')
        )

    def test_repr(self):
        assert repr(MultiplexedPath(self.folder)) == f"MultiplexedPath('{self.folder}')"

    def test_name(self):
        assert MultiplexedPath(self.folder).name == os.path.basename(self.folder)


class NamespaceReaderTest(util.DiskSetup, unittest.TestCase):
    MODULE = 'namespacedata01'

    def test_init_error(self):
        with self.assertRaises(ValueError):
            NamespaceReader(['path1', 'path2'])

    def test_resource_path(self):
        namespacedata01 = import_module('namespacedata01')
        reader = NamespaceReader(namespacedata01.__spec__.submodule_search_locations)

        root = self.data.__path__[0]
        assert reader.resource_path('binary.file') == os.path.join(root, 'binary.file')
        assert reader.resource_path('imaginary') == os.path.join(root, 'imaginary')

    def test_files(self):
        reader = NamespaceReader(self.data.__spec__.submodule_search_locations)
        root = self.data.__path__[0]
        assert isinstance(reader.files(), MultiplexedPath)
        assert repr(reader.files()) == f"MultiplexedPath('{root}')"


if __name__ == '__main__':
    unittest.main()


Current_dir [ 𝗡𝗢𝗧 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
11 Jun 2026 5.00 AM
root / root
0755
__pycache__
--
11 Jun 2026 5.00 AM
root / root
0755
compat
--
11 Jun 2026 5.00 AM
root / root
0755
__init__.py
0 KB
11 Jun 2026 5.00 AM
root / root
0644
_path.py
2.175 KB
11 Jun 2026 5.00 AM
root / root
0644
test_compatibilty_files.py
3.009 KB
11 Jun 2026 5.00 AM
root / root
0644
test_contents.py
0.818 KB
11 Jun 2026 5.00 AM
root / root
0644
test_custom.py
1.193 KB
11 Jun 2026 5.00 AM
root / root
0644
test_files.py
5.343 KB
11 Jun 2026 5.00 AM
root / root
0644
test_functional.py
8.778 KB
11 Jun 2026 5.00 AM
root / root
0644
test_open.py
2.573 KB
11 Jun 2026 5.00 AM
root / root
0644
test_path.py
1.917 KB
11 Jun 2026 5.00 AM
root / root
0644
test_read.py
2.932 KB
11 Jun 2026 5.00 AM
root / root
0644
test_reader.py
4.277 KB
11 Jun 2026 5.00 AM
root / root
0644
test_resource.py
7.796 KB
11 Jun 2026 5.00 AM
root / root
0644
test_util.py
1.079 KB
11 Jun 2026 5.00 AM
root / root
0644
util.py
9.557 KB
11 Jun 2026 5.00 AM
root / root
0644
zip.py
0.563 KB
11 Jun 2026 5.00 AM
root / root
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF