From 974ad07b3684b891b1b5bfbb9e0a6e28874d6a53 Mon Sep 17 00:00:00 2001 From: Jan Pieter Waagmeester Date: Tue, 23 Jul 2024 07:07:05 +0200 Subject: [PATCH] Attempt at shimmming the chenged error message --- tests/test_translating.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/test_translating.py b/tests/test_translating.py index f3281b7..d488bc1 100644 --- a/tests/test_translating.py +++ b/tests/test_translating.py @@ -1,3 +1,4 @@ +import django from django.core.exceptions import ImproperlyConfigured, ValidationError from django.db import models from django.test import TestCase @@ -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()