|
2 | 2 |
|
3 | 3 | from parameterized import parameterized |
4 | 4 |
|
| 5 | +from ai_data_preprocessing_queue.Pipeline import Pipeline |
5 | 6 | from ai_data_preprocessing_queue.Steps.remove_signature import ( |
6 | 7 | remove_greetings_and_following_text, remove_newline) |
7 | 8 |
|
@@ -87,6 +88,46 @@ def test_remove_newline(self, name: str, input_text: str, expected: str) -> None |
87 | 88 | def test_remove_greetings_and_following_text(self, name: str, input_text: str, expected: str) -> None: |
88 | 89 | self.assertEqual(remove_greetings_and_following_text(input_text), expected) |
89 | 90 |
|
| 91 | + @parameterized.expand([ # type: ignore[misc] |
| 92 | + ( |
| 93 | + "remove_signature_basic", |
| 94 | + "We're sending the final draft for review. Best regards, Alice Johnson\nProject Lead", |
| 95 | + "We're sending the final draft for review.", |
| 96 | + ), |
| 97 | + ( |
| 98 | + "thanking_at_start", |
| 99 | + "Thank you very much for your support. " |
| 100 | + "I will prepare the contract and send it tomorrow.\n\nBest regards, Bob Brown", |
| 101 | + "I will prepare the contract and send it tomorrow.", |
| 102 | + ), |
| 103 | + ( |
| 104 | + "thanking_in_middle", |
| 105 | + "Thank you very much for your support. " |
| 106 | + "I appreciate your support on this migration. Thanks a lot, I will share the logs shortly.", |
| 107 | + "I appreciate your support on this migration. I will share the logs shortly.", |
| 108 | + ), |
| 109 | + ( |
| 110 | + "single_greeting_word_german", |
| 111 | + "The deliverables are ready. Grüße", |
| 112 | + "The deliverables are ready.", |
| 113 | + ), |
| 114 | + ( |
| 115 | + "german_empty_result", |
| 116 | + "Vielen Dank für Ihre Hilfe. Mit freundlichen Grüßen, Lena Meyer " |
| 117 | + "Und hier kommt noch mehr Text.", |
| 118 | + "", |
| 119 | + ), |
| 120 | + ( |
| 121 | + "no_change", |
| 122 | + "Please schedule the kickoff meeting for next Tuesday morning at 10:00.", |
| 123 | + "Please schedule the kickoff meeting for next Tuesday morning at 10:00.", |
| 124 | + ), |
| 125 | + ]) |
| 126 | + def test_remove_signature_parameterized(self, name: str, input_text: str, expected: str) -> None: |
| 127 | + pipeline = Pipeline({"remove_signature": None}) |
| 128 | + value = pipeline.consume(input_text) |
| 129 | + self.assertEqual(expected, value) |
| 130 | + |
90 | 131 |
|
91 | 132 | if __name__ == "__main__": |
92 | 133 | unittest.main() |
0 commit comments