(self)
| 30 | cache.clean_test_db(self.test_db) |
| 31 | |
| 32 | def test_cache(self): |
| 33 | translator = AutoIncreaseTranslator("en", "zh", "test", False) |
| 34 | # First translation should be cached |
| 35 | text = "Hello World" |
| 36 | first_result = translator.translate(text) |
| 37 | |
| 38 | # Second translation should return the same result from cache |
| 39 | second_result = translator.translate(text) |
| 40 | self.assertEqual(first_result, second_result) |
| 41 | |
| 42 | # Different input should give different result |
| 43 | different_text = "Different Text" |
| 44 | different_result = translator.translate(different_text) |
| 45 | self.assertNotEqual(first_result, different_result) |
| 46 | |
| 47 | # Test cache with ignore_cache=True |
| 48 | translator.ignore_cache = True |
| 49 | no_cache_result = translator.translate(text) |
| 50 | self.assertNotEqual(first_result, no_cache_result) |
| 51 | |
| 52 | def test_add_cache_impact_parameters(self): |
| 53 | translator = AutoIncreaseTranslator("en", "zh", "test", False) |
nothing calls this directly
no test coverage detected