summaryrefslogtreecommitdiff
path: root/tests/expressions
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2024-06-28 10:27:51 -0400
committernessita <124304+nessita@users.noreply.github.com>2026-02-12 17:01:59 -0300
commita7544eb3e0a6b411a5c540847a46ff0a0b715b97 (patch)
tree8e07beb179e81c4fc090040cbd70eba94798176a /tests/expressions
parent380d77cccefbe185ddb3f9368d8fdeb7b7cf7108 (diff)
Added extra pattern lookup escaping cases in tests/expressions/tests.py.
These new cases have regex characters that must be escaped by backends like MongoDB.
Diffstat (limited to 'tests/expressions')
-rw-r--r--tests/expressions/tests.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py
index e495012e07..cb62d0fbd7 100644
--- a/tests/expressions/tests.py
+++ b/tests/expressions/tests.py
@@ -1462,6 +1462,20 @@ class ExpressionsTests(TestCase):
Employee(firstname="Jean-Claude", lastname="Claude%"),
Employee(firstname="Johnny", lastname="Joh\\n"),
Employee(firstname="Johnny", lastname="_ohn"),
+ # These names have regex characters that must be escaped by
+ # backends (like MongoDB) that use regex matching rather than
+ # LIKE.
+ Employee(firstname="Johnny", lastname="^Joh"),
+ Employee(firstname="Johnny", lastname="Johnny$"),
+ Employee(firstname="Johnny", lastname="Joh."),
+ Employee(firstname="Johnny", lastname="[J]ohnny"),
+ Employee(firstname="Johnny", lastname="(J)ohnny"),
+ Employee(firstname="Johnny", lastname="J*ohnny"),
+ Employee(firstname="Johnny", lastname="J+ohnny"),
+ Employee(firstname="Johnny", lastname="J?ohnny"),
+ Employee(firstname="Johnny", lastname="J{1}ohnny"),
+ Employee(firstname="Johnny", lastname="J|ohnny"),
+ Employee(firstname="Johnny", lastname="J-ohnny"),
]
)
claude = Employee.objects.create(firstname="Jean-Claude", lastname="Claude")