"""Mocks for testing""" class MockInterval(): """Mock Interval object for testing Feature""" def __init__(self, start, end): self.start = start self.end = end self.duration = end - start @classmethod def from_duration(cls, duration): return cls(start=0, end=duration) def to_json(self): return {"start": self.start, "end": self.end} def __eq__(self, other): return self.start == other.start and self.end == other.end class MockFeature(): """Mock feature object for testing""" def __init__(self, interval, source=None, feature_extractor="mock", score=0.0): self.interval = interval self.source = source self.feature_extractor = feature_extractor self.score = score def to_json(self): return {"interval": self.interval} def __eq__(self, other): return (self.interval == other.interval and self.source == other.source and self.feature_extractor == other.feature_extractor) class MockSource(): """Mock Source object for testing Feature""" def __init__(self, source=None, path=None): self.source = source self.path = path def __str__(self): return self.source def to_json(self): return {"source": self.source} def __eq__(self, other): return self.source == other.source def duration(self, duration=30.0): """Mock a float duration""" return duration