pytest_jsonschema_snapshot.tools.name_maker

Classes

NameMaker

Lightweight helper that converts a callable into a string identifier

Module Contents

class NameMaker[source]

Lightweight helper that converts a callable into a string identifier using a tiny placeholder-based template language (keeps backward compatibility with the original test-suite).

Supported placeholders

{package} – full module path (tests.test_mod)

{package_full=SEP} – same but with custom separator (default “.”)

{path} / {path=SEP} – module path without the first segment

{class} – class name or empty string

{method} – function / method name

{class_method} / {…=SEP}Class{SEP}method or just method

Unknown placeholders collapse to an empty string.

After substitution:
  • “//”, “..”, “–” are collapsed to “/”, “.”, “-” respectively;

  • double underscores are preserved so __call__ stays intact.

static format(obj: Callable[Ellipsis, object], rule: str) str[source]

Render rule using metadata extracted from obj.