Explorar o código

Refs #32231 -- Added tests for QuerySet.raw() with an escaped % symbol.

Alexander Lyabah %!s(int64=4) %!d(string=hai) anos
pai
achega
aa3d360631
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      tests/raw_query/tests.py

+ 5 - 0
tests/raw_query/tests.py

@@ -180,6 +180,11 @@ class RawQueryTests(TestCase):
         self.assertEqual(len(results), 1)
         self.assertIsInstance(repr(qset), str)
 
+    def test_escaped_percent(self):
+        query = "SELECT * FROM raw_query_author WHERE first_name like 'J%%'"
+        qset = Author.objects.raw(query)
+        self.assertEqual(len(qset), 2)
+
     @skipUnlessDBFeature('supports_paramstyle_pyformat')
     def test_pyformat_params(self):
         """