schema_salad.tests.test_avro_names

Avro related tests.

Classes

Names

Track name set and default namespace during parsing.

Functions

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_avro_loading()

Confirm conversion of SALAD style names to avro.

Module Contents

class schema_salad.tests.test_avro_names.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

schema_salad.tests.test_avro_names.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_avro_names.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_avro_names.test_avro_loading()

Confirm conversion of SALAD style names to avro.

Return type:

None