Skip to main content

SingleZipReader

This class extends the standard zipfile.ZipFile to provide specialized handling for zip-compressed fixtures that must contain exactly one file. It validates the archive contents upon initialization and overrides the read method to automatically return the contents of the single internal file.

Constructor

Signature

def SingleZipReader(
*args: any,
**kwargs: any
) - > null

Parameters

NameTypeDescription
*argsanyVariable length argument list passed to the parent ZipFile constructor.
**kwargsanyArbitrary keyword arguments passed to the parent ZipFile constructor.

Signature

def SingleZipReader(
*args: any,
**kwargs: any
)

Parameters

NameTypeDescription
*argsanyPositional arguments passed to the underlying zipfile.ZipFile constructor, such as the file path or file-like object.
**kwargsanyKeyword arguments passed to the underlying zipfile.ZipFile constructor, such as the mode or compression type.

Methods


read()

@classmethod
def read() - > bytes

Reads and returns the uncompressed content of the single file contained within the ZIP archive.

Returns

TypeDescription
bytesThe raw byte content of the first and only file found in the ZIP archive.