The language restored is the one used when the function was called, not the one used when the decorator was initialized (#23381).
(self)
| 209 | deactivate() |
| 210 | |
| 211 | def test_override_exit(self): |
| 212 | """ |
| 213 | The language restored is the one used when the function was |
| 214 | called, not the one used when the decorator was initialized (#23381). |
| 215 | """ |
| 216 | activate("fr") |
| 217 | |
| 218 | @translation.override("pl") |
| 219 | def func_pl(): |
| 220 | pass |
| 221 | |
| 222 | deactivate() |
| 223 | |
| 224 | try: |
| 225 | activate("en") |
| 226 | func_pl() |
| 227 | self.assertEqual(get_language(), "en") |
| 228 | finally: |
| 229 | deactivate() |
| 230 | |
| 231 | def test_lazy_objects(self): |
| 232 | """ |
nothing calls this directly
no test coverage detected