From 736678e89d0814087954d7f7f3ca73f8b837c0d5 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Mon, 8 Dec 2025 11:36:33 -0500 Subject: [PATCH] Fix class name in error message when Func is missing as_mql() --- django_mongodb_backend/functions.py | 2 +- tests/db_functions_/tests.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/django_mongodb_backend/functions.py b/django_mongodb_backend/functions.py index c5d3a270e..9339840cc 100644 --- a/django_mongodb_backend/functions.py +++ b/django_mongodb_backend/functions.py @@ -109,7 +109,7 @@ def extract(self, compiler, connection): def func(self, compiler, connection): lhs_mql = process_lhs(self, compiler, connection, as_expr=True) if self.function is None: - raise NotSupportedError(f"{self} may need an as_mql() method.") + raise NotSupportedError(f"{self.__class__.__name__} may need an as_mql() method.") operator = MONGO_OPERATORS.get(self.__class__, self.function.lower()) return {f"${operator}": lhs_mql} diff --git a/tests/db_functions_/tests.py b/tests/db_functions_/tests.py index 23029d42e..03aad92cd 100644 --- a/tests/db_functions_/tests.py +++ b/tests/db_functions_/tests.py @@ -5,6 +5,6 @@ class FuncTests(SimpleTestCase): def test_no_as_mql(self): - msg = "Func() may need an as_mql() method." + msg = "Func may need an as_mql() method." with self.assertRaisesMessage(NotSupportedError, msg): Func().as_mql(None, None)