parents

parents
(
PathType
)
(
auto ref in PathType p
)

Return Value

Type: auto

The parts of the path as an array, without the last component.

Examples

assertEmpty(Path().parents);
assertEqual(WindowsPath("C:/hello/world").parents, [WindowsPath(`C:\hello`), WindowsPath(`C:\`)]);
assertEqual(WindowsPath("C:/hello/world/").parents, [WindowsPath(`C:\hello`), WindowsPath(`C:\`)]);
assertEqual(PosixPath("/hello/world").parents, [PosixPath("/hello"), PosixPath("/")]);
assertEqual(PosixPath("/hello/world/").parents, [PosixPath("/hello"), PosixPath("/")]);

Meta