pyxsdtestdata

Package for managing XSD test data

This package provides methods for managing test data from the xsdtests database. The XSDTestData class is used to initialise and manage the datasets. This package is a wrapper for the xsdtestdata Rust crate.

class pyxsdtestdata.XSDTestData(database_dir, archive_path)

Class for managing XSD Test Data from the xsdtests database.

The class manages the data in the xsdtests database. When initialised, the class searches for the database at the database_dir. If found, it builds the object using the contents of this directory.

If the database_dir` does not exist, the class searches for an archive file at archive_path. If this is found, it extracts the contents to database_dir. Otherwise, it downloads the archive from the xsdtests repo.

This class is a wrapper for the xsdtestdata::XSDTestData.

Parameters:
  • database_dir (pathlib.Path) – Path to the (current or target) directory for the database.

  • archive_path (pathlib.Path) – Path to the zip file containing the database

Returns:

Data about all XSD files in the database

Return type:

XSDTestData

Raises:

RuntimeError – Error while setting up the database

get(key)

Get the XSDData for the XSD file with key

Parameters:

key (str) – Key for the required XSD file

Returns:

If the key is present, returns the XSDData for the specified XSD. Otherwise returns None.

Return type:

XSDData | None

class pyxsdtestdata.XSDData

XSD Data Class containing information about a single XSD file

Includes data about an XSD file, including:

  • Path to file

  • Data set it belongs to

  • Validity of XSD

No constructor is included, instances are created by the XSDTestData class. The class provides Python bindings for the rust:struct:xsdtestdata::XSDData Rust struct and its methods.

data_set()

Get the data set to which the XSD file belongs

Returns:

Data set name

Return type:

str

key()

Get the unique key associated with the XSD file

Returns:

Unique key for the file in the test set

Return type:

str

path()

Get the filepath of the XSD file

Returns:

Path to XSD file

Return type:

pathlib.Path

valid()

Whether the XSD file is listed as valid

Returns:

Validity of XSD

Return type:

bool

pyxsdtestdata.version()

Return the version of the xmlgenerator Rust crate

Returns:

The version of the Rust crate

Return type:

str