tests: playlist_import, log_archiver, sound_stats.SoxStats

This commit is contained in:
bkfox
2023-06-22 23:29:51 +02:00
parent a289e1ef05
commit b2f4bce717
8 changed files with 282 additions and 82 deletions

View File

@ -3,7 +3,7 @@ from collections import namedtuple
import inspect
__all__ = ("interface", "Interface")
__all__ = ("interface", "Interface", "File")
def interface(obj, funcs):
@ -233,6 +233,7 @@ class Interface:
def _irelease(self):
"""Shortcut to `self._imeta.release`."""
self._imeta.release()
self._imeta.reset()
def _trace(self, *args, **kw):
"""Shortcut to `self._imeta.get_trace`."""
@ -266,3 +267,23 @@ class Interface:
def __str__(self):
iface = super().__str__()
return f"{iface}::{self._imeta.target}"
class File:
def __init__(self, data=""):
self.data = data
def read(self):
return self.data
def write(self, data):
self.data += data
def close(self):
self.data = None
def __enter__(self):
return self
def __exit__(self, *_, **__):
pass