def test__check_initialpaths_for_relpath() -> None:
    """Ensure that it handles dirs, and does not always use dirname."""
    cwd = Path.cwd()

    initial_paths = frozenset({cwd})

    assert nodes._check_initialpaths_for_relpath(initial_paths, cwd) == ""

    sub = cwd / "file"
    assert nodes._check_initialpaths_for_relpath(initial_paths, sub) == "file"

    outside = Path("/outside-this-does-not-exist")
    assert nodes._check_initialpaths_for_relpath(initial_paths, outside) is None
Ensure that it handles dirs, and does not always use dirname.
testing/test_nodes.py