def test_strip_pause_only(self): pause = Pause(beg=1.25, end=1.95) utt_strip = Utterance([pause]) utt_strip.strip() assert_equal(utt_strip.words(), [])
def test_strip_end_zero(self): zero = Word('', 1.25, 1.25) utt_strip = Utterance(self.words + [zero]) utt_strip.strip() assert_not_in(zero, utt_strip) assert_equal(utt_strip.words(), self.words)
def test_strip_beg_zero(self): zero = Word('', 0.0, 0.0) utt_strip = Utterance([zero] + self.words) utt_strip.strip() assert_not_in(zero, utt_strip) assert_equal(utt_strip.words(), self.words)
def test_strip_end_pause(self): pause = Pause(beg=1.25, end=1.85) utt_strip = Utterance(self.words + [pause]) utt_strip.strip() assert_not_in(pause, utt_strip) assert_equal(utt_strip.words(), self.words)
def test_strip_beg_pause(self): pause = Pause(beg=0, end=0.55) utt_strip = Utterance([pause] + self.words[3:]) utt_strip.strip() assert_not_in(pause, utt_strip) assert_equal(utt_strip.words(), self.words[3:])
def test_strip_end_multiple(self): pause = Pause(beg=1.25, end=1.95) zero = Word('', 1.95, 1.95) utt_strip = Utterance() utt_strip._words = self.words + [pause, zero] utt_strip.strip() for entry in {pause, zero}: assert_not_in(entry, utt_strip) assert_equal(utt_strip.words(), self.words)
def test_strip_beg_multiple(self): pause = Pause(beg=0, end=0.39) zero = Word('', 0.39, 0.39) utt_strip = Utterance() utt_strip._words = [pause, zero] + self.words[2:] utt_strip.strip() for entry in {pause, zero}: assert_not_in(entry, utt_strip) assert_equal(utt_strip.words(), self.words[2:])