Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added unit tests to verify #800. Refs #800

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1324 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit db94402ea69fb3ba14288441cd28938c568586f5 1 parent 270377c
Adrian Holovaty adrianholovaty authored
Showing with 15 additions and 0 deletions.
  1. +15 −0 tests/testapp/models/lookup.py
15 tests/testapp/models/lookup.py
View
@@ -122,4 +122,19 @@ def __repr__(self):
Article 2
>>> a2.get_previous_by_pub_date()
Article 1
+
+# Underscores and percent signs have special meaning in the underlying
+# database library, but Django handles the quoting of them automatically.
+>>> a8 = articles.Article(headline='Article_ with underscore', pub_date=datetime(2005, 11, 20))
+>>> a8.save()
+>>> articles.get_list(headline__startswith='Article')
+[Article_ with underscore, Article 5, Article 6, Article 4, Article 2, Article 3, Article 7, Article 1]
+>>> articles.get_list(headline__startswith='Article_')
+[Article_ with underscore]
+>>> a9 = articles.Article(headline='Article% with percent sign', pub_date=datetime(2005, 11, 21))
+>>> a9.save()
+>>> articles.get_list(headline__startswith='Article')
+[Article% with percent sign, Article_ with underscore, Article 5, Article 6, Article 4, Article 2, Article 3, Article 7, Article 1]
+>>> articles.get_list(headline__startswith='Article%')
+[Article% with percent sign]
"""
Please sign in to comment.
Something went wrong with that request. Please try again.