Skip to content

Commit

Permalink
Attempt at shimmming the chenged error message
Browse files Browse the repository at this point in the history
  • Loading branch information
jieter committed Jul 23, 2024
1 parent e3d0d5a commit 974ad07
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/test_translating.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import django
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.db import models
from django.test import TestCase
Expand Down Expand Up @@ -289,9 +290,12 @@ def test_limit_choices_to(self):
comment = app_models.Comment.objects.create(post=published_post, text="foo")
self.assertIsNotNone(comment.pk)

with self.assertRaisesMessage(
ValidationError,
f"post instance with id {unpublished_post.pk} does not exist",
):
print(django.get_version())
if django.get_version().startswith("5.2"):
expected = f"post instance with id {unpublished_post.pk} is not a valid choice."
else:
expected = f"post instance with id {unpublished_post.pk} does not exist"

with self.assertRaisesMessage(ValidationError, expected):
comment.post = unpublished_post
comment.full_clean()

0 comments on commit 974ad07

Please sign in to comment.