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