We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1a77ee5 commit a5a03c3Copy full SHA for a5a03c3
tests/test_models.py
@@ -249,12 +249,13 @@ def failing_str_method(self):
249
250
version = factories.PollVersionFactory()
251
original_str_method = version.content.__class__.__str__
252
- version.content.__class__.__str__ = failing_str_method
+ try:
253
+ version.content.__class__.__str__ = failing_str_method
254
- expected_str = f"Version #{version.pk} (Draft)"
255
- self.assertEqual(str(version), expected_str)
256
-
257
- version.content.__class__.__str__ = original_str_method
+ expected_str = f"Version #{version.pk} (Draft)"
+ self.assertEqual(str(version), expected_str)
+ finally:
258
+ version.content.__class__.__str__ = original_str_method
259
260
261
class TestVersionQuerySet(CMSTestCase):
0 commit comments