docstr: Dotted name and parts.
docstr_tok: ["Dotted","name","and","parts","."]
code: def test_pypath(self, invocation_path: Path) -> None:
      """Dotted name and parts."""
      assert resolve_collection_argument(
          invocation_path, "pkg.test", as_pypath=True
      ) == (invocation_path / "src/pkg/test.py", [])
      assert resolve_collection_argument(
          invocation_path, "pkg.test::foo::bar", as_pypath=True
      ) == (invocation_path / "src/pkg/test.py", ["foo", "bar"])
      assert resolve_collection_argument(
          invocation_path, "pkg", as_pypath=True
      ) == (
          invocation_path / "src/pkg",
          [],
      )
  
      with pytest.raises(
          UsageError,
          match=r"package argument cannot contain :: selection parts",
      ):
          resolve_collection_argument(
              invocation_path, "pkg::foo::bar", as_pypath=True
          )
  
imports: import argparse
  import os
  import re
  import sys
  from pathlib import Path
  from typing import Optional
  import pytest
  from _pytest.config import ExitCode
  from _pytest.config import UsageError
  from _pytest.main import resolve_collection_argument
  from _pytest.main import validate_basetemp
  from _pytest.pytester import Pytester
label_desc: Use image node_id 4 for calling the TestResolveCollectionArgument obj's underlying member method code with example usage: obj.test_pypath(invocation_path) without return types