File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
waveform_editor/tendencies Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -166,3 +166,10 @@ def test_filled(repeat_waveform):
166166 assert tendencies [2 ].base == 2
167167 assert tendencies [2 ].amplitude == - 1
168168 assert tendencies [2 ].frequency == 0.25
169+
170+
171+ def test_too_short (repeat_waveform ):
172+ """Test for warning if repeated waveform does not have a single repetition."""
173+ repeat_waveform ["user_duration" ] = 2
174+ repeat_tendency = RepeatTendency (** repeat_waveform )
175+ assert repeat_tendency .annotations
Original file line number Diff line number Diff line change @@ -18,14 +18,21 @@ def __init__(self, **kwargs):
1818
1919 self .waveform = Waveform (waveform = waveform , is_repeated = True )
2020 if not self .waveform .tendencies :
21- error_msg = "There are no tendencies in the repeated waveform."
21+ error_msg = "There are no tendencies in the repeated waveform.\n "
2222 self .annotations .add (self .line_number , error_msg )
2323 return
2424
2525 if self .waveform .tendencies [0 ].start != 0 :
26- error_msg = "The starting point of the first repeated must be set to 0."
26+ error_msg = "The starting point of the first repeated must be set to 0.\n "
2727 self .annotations .add (self .line_number , error_msg )
2828
29+ if self .duration < self .waveform .tendencies [- 1 ].end :
30+ error_msg = (
31+ "The repeated tendency has not completed a single repetition.\n "
32+ "Perhaps change the length of the repeated tendency?\n "
33+ )
34+ self .annotations .add (self .line_number , error_msg , is_warning = True )
35+
2936 # Link the last tendency to the first tendency in the repeated waveform
3037 # We must lock the start to 0, otherwise it will take the start value of the
3138 # previous tendency.
You can’t perform that action at this time.
0 commit comments