def test_handle_repetitions_10_repetitions(self): """Test with 10 repetitions.""" actual_output = CHATUtteranceCleaner.handle_repetitions('a [x 10]') desired_output = 'a a a a a a a a a a' self.assertEqual(actual_output, desired_output)
def test_handle_repetitions_no_whitespace(self): """Test handle_repetitions with missing whitespace.""" actual_output = CHATUtteranceCleaner.handle_repetitions('hello[x 2]') desired_output = 'hello hello' self.assertEqual(actual_output, desired_output)
def test_handle_repetitions_scoped_symbol_before(self): """Test with a preceding scoped symbol.""" utterance = 'hey@i [=! screams] [x 2] .' actual_output = CHATUtteranceCleaner.handle_repetitions(utterance) desired_output = 'hey@i [=! screams] hey@i [=! screams] .' self.assertEqual(actual_output, desired_output)
def test_handle_repetitions_empty_string(self): """Test handle_repetitions with an empty string.""" actual_output = CHATUtteranceCleaner.handle_repetitions('') desired_output = '' self.assertEqual(actual_output, desired_output)
def test_handle_repetitions_non_scope_angle_bracket(self): """Test with a non-scope angle bracket `[<]`.""" utterance = 'ha [<] <ho ho> [x 2]' actual_output = CHATUtteranceCleaner.handle_repetitions(utterance) desired_output = 'ha [<] ho ho ho ho' self.assertEqual(actual_output, desired_output)
def test_handle_repetitions_scope_over_three_words(self): """Test handle_repetitions with a scope of 3 words.""" actual_output = CHATUtteranceCleaner.handle_repetitions( '<how are you> [x 2]') desired_output = 'how are you how are you' self.assertEqual(actual_output, desired_output)
def test_handle_repetitions_multiple_repetitions(self): """Test handle_repetitions with an utt containing 2 reps.""" actual_output = CHATUtteranceCleaner.handle_repetitions( 'Hey [x 2] there [x 3]') desired_output = 'Hey Hey there there there' self.assertEqual(actual_output, desired_output)
def test_handle_repetitions_single_repetition(self): """Test handle_repetitions with an utt containing 1 rep.""" actual_output = CHATUtteranceCleaner.handle_repetitions( "it's [x 4] like a um dog.") desired_output = "it's it's it's it's like a um dog." self.assertEqual(actual_output, desired_output)