Commit a57315c9 authored by Tanguy Le Carrour's avatar Tanguy Le Carrour
Browse files

Handle wrong interval values.

parent 0943662e
......@@ -50,7 +50,7 @@ class ExtractSubTracksInteractor:
for (start, end) in some_intervals:
try:
results.append(Interval(int(start), int(end)))
except AttributeError:
except (AttributeError, ValueError):
self.__presenter.wrong_interval(start, end)
continue
return results
......@@ -53,3 +53,11 @@ with describe("Extract sub-tracks"):
interactor.execute(request)
expect(self.presenter.wrong_interval).to.have.been.called()
with it("handles wrong interval values"):
interactor = ExtractSubTracksInteractor(self.presenter, self.tracks)
request = ExtractSubTracksRequest("a_track.wav", [("1,2", "")])
interactor.execute(request)
expect(self.presenter.wrong_interval).to.have.been.called()
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