Commit 5e7b2fcd authored by Philip ABBET's avatar Philip ABBET
Browse files

Update to the beat.backend.python v1.4.1

parent 1acd7686
......@@ -28,21 +28,21 @@
class DoneCrashes:
def setup(self, *args, **kwargs): return True
def next(self): return True
def done(self):
def done(self, last_data_index):
a = b
return True
class NextCrashes:
def setup(self, *args, **kwargs): return True
def done(self): return False
def done(self, last_data_index): return False
def next(self):
a = b
return True
class SetupCrashes:
def done(self): return True
def done(self, last_data_index): return True
def next(self): return True
def setup(self, *args, **kwargs):
a = b
......@@ -50,5 +50,5 @@ class SetupCrashes:
class SetupFails:
def setup(self, *args, **kwargs): return False
def done(self): return True
def done(self, last_data_index): return True
def next(self): return True
......@@ -37,8 +37,8 @@ class Double:
return True
def done(self):
return (self.outputs['a'].last_written_data_index == 9)
def done(self, last_data_index):
return (last_data_index == 9)
def next(self):
......@@ -68,8 +68,8 @@ class Triple:
return True
def done(self):
return (self.outputs['a'].last_written_data_index == 9)
def done(self, last_data_index):
return (last_data_index == 9)
def next(self):
......@@ -109,8 +109,8 @@ class Labelled:
return True
def done(self):
return (len(self.remaining) == 0)
def done(self, last_data_index):
return (last_data_index == 14)
def next(self):
......@@ -153,11 +153,8 @@ class DifferentFrequencies:
return True
def done(self):
if self.outputs['b'].isConnected():
return (self.outputs['b'].last_written_data_index == 7)
else:
return (self.outputs['a'].last_written_data_index == 7)
def done(self, last_data_index):
return (last_data_index == 7)
def next(self):
......
......@@ -36,8 +36,8 @@ class LargeView:
return True
def done(self):
return (self.outputs['out'].last_written_data_index == 1000)
def done(self, last_data_index):
return (last_data_index == 1000)
def next(self):
......@@ -59,8 +59,8 @@ class SmallView:
return True
def done(self):
return (self.outputs['out'].last_written_data_index == 1000)
def done(self, last_data_index):
return (last_data_index == 1000)
def next(self):
......
......@@ -37,15 +37,20 @@ class View:
def setup(self, root_folder, outputs, parameters, force_start_index=None, force_end_index=None):
self.outputs = outputs
if force_start_index is not None: self.force_start_index = force_start_index
else: self.force_start_index = 0
if force_end_index is not None: self.force_end_index = force_end_index
else: self.force_end_index = 1
if force_start_index is not None:
self.force_start_index = force_start_index
else:
self.force_start_index = 0
if force_end_index is not None:
self.force_end_index = force_end_index
else:
self.force_end_index = 1
self.current_index = self.force_start_index
return True
def done(self):
def done(self, last_data_index):
return self.current_index != 0
def next(self):
......@@ -59,15 +64,20 @@ class View2:
def setup(self, root_folder, outputs, parameters, force_start_index=None, force_end_index=None):
self.outputs = outputs
if force_start_index is not None: self.force_start_index = force_start_index
else: self.force_start_index = 0
if force_end_index is not None: self.force_end_index = force_end_index
else: self.force_end_index = 1
if force_start_index is not None:
self.force_start_index = force_start_index
else:
self.force_start_index = 0
if force_end_index is not None:
self.force_end_index = force_end_index
else:
self.force_end_index = 1
self.current_index = self.force_start_index
return True
def done(self):
def done(self, last_data_index):
return self.current_index != 0
def next(self):
......@@ -81,15 +91,20 @@ class LargeView:
def setup(self, root_folder, outputs, parameters, force_start_index=None, force_end_index=None):
self.outputs = outputs
if force_start_index is not None: self.force_start_index = force_start_index
else: self.force_start_index = 0
if force_end_index is not None: self.force_end_index = force_end_index
else: self.force_end_index = 4
if force_start_index is not None:
self.force_start_index = force_start_index
else:
self.force_start_index = 0
if force_end_index is not None:
self.force_end_index = force_end_index
else:
self.force_end_index = 4
self.current_index = self.force_start_index
return True
def done(self):
def done(self, last_data_index):
return self.current_index > self.force_end_index
def next(self):
......
......@@ -40,7 +40,7 @@ class View:
return True
def done(self):
def done(self, last_data_index):
return self.must_return_done
......
......@@ -58,7 +58,7 @@ def test_not_done():
assert db.valid, '\n * %s' % '\n * '.join(db.errors)
view = db.view('valid', 'valid', MyExc)
assert view.setup()
assert view.done() is False
assert view.done(-1) is False
def test_done():
......@@ -66,9 +66,9 @@ def test_done():
assert db.valid, '\n * %s' % '\n * '.join(db.errors)
view = db.view('valid', 'valid', MyExc)
assert view.setup()
assert view.done() is False
assert view.done(-1) is False
# manually setting property on obj implementing the view for testing purposes
view.obj.must_return_done = True
assert view.done()
assert view.done(-1)
......@@ -43,8 +43,8 @@ def test_one_sink_to_one_source():
last_written_index = -1
def _done_callback():
return (last_written_index == 4)
def _done_callback(last_data_index):
return (last_data_index == 4)
data_source = MemoryDataSource(_done_callback)
nose.tools.eq_(len(data_source.data), 0)
......@@ -94,7 +94,7 @@ def test_source_callback():
is_done = False
def _done_callback():
def _done_callback(last_data_index):
return is_done
def _next_callback():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment