|
1234567891011121314151617181920212223242526272829303132333435363738394041 |
- """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
-
- def to_json(self):
- return {"start": self.start, "end": self.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}
-
- 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
|