benchmarkstt.schema module

Defines the main schema for comparison and implements json serialization

class benchmarkstt.schema.Item(*args, **kwargs)[source]

Bases: collections.abc.Mapping

Basic structure of each field to compare

Raises:ValueError, SchemaInvalidItemError
json(**kwargs)[source]
class benchmarkstt.schema.JSONDecoder(*args, **kwargs)[source]

Bases: json.decoder.JSONDecoder

Custom JSON decoding for schema

decode(*args, **kwargs)[source]

Return the Python representation of s (a str instance containing a JSON document).

static object_hook(obj)[source]
class benchmarkstt.schema.JSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

Bases: json.encoder.JSONEncoder

Custom JSON encoding for schema

default(o)[source]

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)
encode(obj)[source]

Return a JSON string representation of a Python data structure.

>>> from json.encoder import JSONEncoder
>>> JSONEncoder().encode({"foo": ["bar", "baz"]})
'{"foo": ["bar", "baz"]}'
class benchmarkstt.schema.Meta[source]

Bases: collections.defaultdict

Containing metadata for an item, such as skipped

class benchmarkstt.schema.Schema(data=None)[source]

Bases: object

Basically a list of Item

append(obj: Union[benchmarkstt.schema.Item, dict])[source]
static dump(cls, *args, **kwargs)[source]
static dumps(cls, *args, **kwargs)[source]
extend(iterable)[source]
json(**kwargs)[source]
static load(*args, **kwargs)[source]
static loads(*args, **kwargs)[source]
exception benchmarkstt.schema.SchemaError[source]

Bases: ValueError

Top Error class for all schema related exceptions

exception benchmarkstt.schema.SchemaInvalidItemError[source]

Bases: benchmarkstt.schema.SchemaError

Attempting to add an invalid item

exception benchmarkstt.schema.SchemaJSONError[source]

Bases: benchmarkstt.schema.SchemaError

When loading incompatible JSON