|
@@ -7,9 +7,16 @@ class MockInterval(): |
|
|
self.end = end |
|
|
self.end = end |
|
|
self.duration = end - start |
|
|
self.duration = end - start |
|
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
|
def from_duration(cls, duration): |
|
|
|
|
|
return cls(start=0, end=duration) |
|
|
|
|
|
|
|
|
def to_json(self): |
|
|
def to_json(self): |
|
|
return {"start": self.start, "end": self.end} |
|
|
return {"start": self.start, "end": self.end} |
|
|
|
|
|
|
|
|
|
|
|
def __eq__(self, other): |
|
|
|
|
|
return self.start == other.start and self.end == other.end |
|
|
|
|
|
|
|
|
class MockFeature(): |
|
|
class MockFeature(): |
|
|
"""Mock feature object for testing""" |
|
|
"""Mock feature object for testing""" |
|
|
def __init__(self, interval, source=None, feature_extractor="mock", score=0.0): |
|
|
def __init__(self, interval, source=None, feature_extractor="mock", score=0.0): |
|
@@ -21,6 +28,10 @@ class MockFeature(): |
|
|
def to_json(self): |
|
|
def to_json(self): |
|
|
return {"interval": self.interval} |
|
|
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(): |
|
|
class MockSource(): |
|
|
"""Mock Source object for testing Feature""" |
|
|
"""Mock Source object for testing Feature""" |
|
|
def __init__(self, source=None, path=None): |
|
|
def __init__(self, source=None, path=None): |
|
|