CustomSerializer#

class langchain_tests.conftest.CustomSerializer[source]#

Custom serializer for VCR cassettes using YAML and gzip.

We’re using a custom serializer to avoid the default yaml serializer used by VCR, which is not designed to be safe for untrusted input.

This step is an extra precaution necessary because the cassette files are in compressed YAML format, which makes it more difficult to inspect their contents during development or debugging.

Methods

deserialize(data)

Decompress data and convert it from YAML.

serialize(cassette_dict)

Convert cassette to YAML and compress it.

static deserialize(data: bytes) β†’ dict[source]#

Decompress data and convert it from YAML.

Parameters:

data (bytes)

Return type:

dict

static serialize(cassette_dict: dict) β†’ bytes[source]#

Convert cassette to YAML and compress it.

Parameters:

cassette_dict (dict)

Return type:

bytes