schema_salad.tests.test_fp

Exceptions

ValidationException

Indicates error with document against the provided schema.

Classes

Names

Track name set and default namespace during parsing.

Functions

load_and_validate(document_loader, avsc_names, ...[, ...])

Load a document and validate it with the provided schema.

load_schema(schema_ref[, cache])

Load a schema that can be used to validate documents using load_and_validate.

get_data(filename)

Get the file path for a given schema file name.

test_fp()

Module Contents

class schema_salad.tests.test_fp.Names(default_namespace=None)

Track name set and default namespace during parsing.

Parameters:

default_namespace (Optional[str])

has_name(name_attr, space_attr)
Parameters:
  • name_attr (str)

  • space_attr (Optional[str])

Return type:

bool

get_name(name_attr, space_attr)

Fetch the stored schema for the given namespace.

Parameters:
  • name_attr (str)

  • space_attr (Optional[str])

Return type:

Optional[NamedSchema]

add_name(name_attr, space_attr, new_schema)

Add a new schema object to the name set.

Parameters:
  • name_attr (str) – name value read in schema

  • space_attr (Optional[str]) – namespace value read in schema.

  • new_schema (NamedSchema)

Returns:

the Name that was just added.

Return type:

Name

exception schema_salad.tests.test_fp.ValidationException(msg, sl=None, children=None, bullet_for_children='')

Bases: SchemaSaladException

digraph inheritancebf1371985d { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "SchemaSaladException" [URL="../../exceptions/index.html#schema_salad.exceptions.SchemaSaladException",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for all schema-salad exceptions."]; "ValidationException" [URL="../../exceptions/index.html#schema_salad.exceptions.ValidationException",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Indicates error with document against the provided schema."]; "SchemaSaladException" -> "ValidationException" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

Indicates error with document against the provided schema.

Parameters:
schema_salad.tests.test_fp.load_and_validate(document_loader, avsc_names, document, strict, strict_foreign_properties=False)

Load a document and validate it with the provided schema.

return data, metadata

Parameters:
Return type:

Tuple[Any, Dict[str, Any]]

schema_salad.tests.test_fp.load_schema(schema_ref, cache=None)

Load a schema that can be used to validate documents using load_and_validate.

Returns:

document_loader, avsc_names, schema_metadata, metaschema_loader

Parameters:
  • schema_ref (schema_salad.utils.ResolveType)

  • cache (Optional[schema_salad.utils.CacheType])

Return type:

schema_type

schema_salad.tests.test_fp.get_data(filename)

Get the file path for a given schema file name.

It is able to find file names in the schema_salad namespace, but also able to load schema files from the tests directory.

Parameters:

filename (str)

Return type:

Optional[str]

schema_salad.tests.test_fp.test_fp()
Return type:

None