Browse Source

test: [mocks] add attrs to MockFeature + MockSource.duration()

main
Rob Hallam 3 months ago
parent
commit
ff09cd4b8f
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      test/mocks.py

+ 7
- 1
test/mocks.py View File

@@ -12,9 +12,11 @@ class MockInterval():


class MockFeature(): class MockFeature():
"""Mock feature object for testing""" """Mock feature object for testing"""
def __init__(self, interval, source=None):
def __init__(self, interval, source=None, feature_extractor="mock", score=0.0):
self.interval = interval self.interval = interval
self.source = source self.source = source
self.feature_extractor = feature_extractor
self.score = score


def to_json(self): def to_json(self):
return {"interval": self.interval} return {"interval": self.interval}
@@ -33,3 +35,7 @@ class MockSource():


def __eq__(self, other): def __eq__(self, other):
return self.source == other.source return self.source == other.source

def duration(self, duration=30.0):
"""Mock a float duration"""
return duration

Loading…
Cancel
Save