Test that cache distinguishes between different engine parameters
(self)
| 77 | self.assertEqual(cache2.get("hello"), "你好 2") |
| 78 | |
| 79 | def test_params_distinction(self): |
| 80 | """Test that cache distinguishes between different engine parameters""" |
| 81 | params1 = {"param": "value1"} |
| 82 | params2 = {"param": "value2"} |
| 83 | cache1 = cache.TranslationCache("test_engine", params1) |
| 84 | cache2 = cache.TranslationCache("test_engine", params2) |
| 85 | |
| 86 | # Set same text with different parameters |
| 87 | cache1.set("hello", "你好 1") |
| 88 | cache2.set("hello", "你好 2") |
| 89 | |
| 90 | # Verify each parameter set gets its own translation |
| 91 | self.assertEqual(cache1.get("hello"), "你好 1") |
| 92 | self.assertEqual(cache2.get("hello"), "你好 2") |
| 93 | |
| 94 | def test_consistent_param_serialization(self): |
| 95 | """Test that dictionary parameters are consistently serialized regardless of key order""" |