ocebuild.errors.validation#

Validation methods used for testing and at runtime.

Module Contents#

Functions#

validate(→ None)

Throws a ValidationError with the given message.

validate_path_tree(→ Literal[True])

Validates a given path matches a tree schema.

ocebuild.errors.validation.validate(call: Callable[[], bool], err: Exception | Callable[[Tuple[any, Ellipsis]], Exception], msg: str | None) None[source]#

Throws a ValidationError with the given message.

ocebuild.errors.validation.validate_path_tree(path: str | PathLike[str], tree: dict, delimiter: str = '/') Literal[True][source]#

Validates a given path matches a tree schema.

Parameters:
  • path – The path to validate.

  • tree – The tree schema to validate against.

  • delimiter – The delimiter to use when flattening the tree.

Raises:

PathValidationError – If the path does not match the tree schema.

Returns:

True if the path matches the tree schema.