summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2006-05-31 19:10:43 +0000
committerAdrian Holovaty <adrian@holovaty.com>2006-05-31 19:10:43 +0000
commita846155118747d6cdebaa92326eac1b08118e8ff (patch)
treeda936f1ab8e6390f2fc5d2043be06b327483451d /tests
parent3daae59aab8d573ddec0c66a47c12a8baac7dd49 (diff)
Small formatting changes to model unit tests to make them look better in the model examples online
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3030 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/modeltests/custom_methods/models.py2
-rw-r--r--tests/modeltests/m2m_and_m2o/models.py4
-rw-r--r--tests/modeltests/pagination/models.py25
-rw-r--r--tests/modeltests/transactions/models.py2
-rw-r--r--tests/modeltests/validation/models.py4
5 files changed, 19 insertions, 18 deletions
diff --git a/tests/modeltests/custom_methods/models.py b/tests/modeltests/custom_methods/models.py
index 3fdefca6bf..6cc3fe8548 100644
--- a/tests/modeltests/custom_methods/models.py
+++ b/tests/modeltests/custom_methods/models.py
@@ -1,5 +1,5 @@
"""
-3. Giving models custom methods and custom managers
+3. Giving models custom methods
Any method you add to a model will be available to instances.
"""
diff --git a/tests/modeltests/m2m_and_m2o/models.py b/tests/modeltests/m2m_and_m2o/models.py
index 29631e5779..2c2c696fd6 100644
--- a/tests/modeltests/m2m_and_m2o/models.py
+++ b/tests/modeltests/m2m_and_m2o/models.py
@@ -1,5 +1,5 @@
"""
-27. Many-to-many and many-to-one relationships to the same table.
+27. Many-to-many and many-to-one relationships to the same table
This is a response to bug #1535
@@ -16,7 +16,7 @@ class Issue(models.Model):
client = models.ForeignKey(User, related_name='test_issue_client')
def __repr__(self):
return "<Issue %d>" % (self.num,)
-
+
class Meta:
ordering = ('num',)
diff --git a/tests/modeltests/pagination/models.py b/tests/modeltests/pagination/models.py
index 6525168b97..d0a91ad824 100644
--- a/tests/modeltests/pagination/models.py
+++ b/tests/modeltests/pagination/models.py
@@ -1,21 +1,20 @@
"""
-20. Object Pagination
-
-Django provides a framework for paginating a list of objects in a few.
-This is often useful for dividing search results or long lists of objects
-in to easily readable pages.
-
+28. Object pagination
+Django provides a framework for paginating a list of objects in a few lines
+of code. This is often useful for dividing search results or long lists of
+objects into easily readable pages.
"""
+
from django.db import models
class Article(models.Model):
headline = models.CharField(maxlength=100, default='Default headline')
pub_date = models.DateTimeField()
-
+
def __repr__(self):
- return self.headline
-
+ return self.headline
+
API_TESTS = """
# prepare a list of objects for pagination
>>> from datetime import datetime
@@ -34,8 +33,8 @@ API_TESTS = """
>>> paginator.pages
2
-# get the first page (zero-based)
->>> paginator.get_page(0)
+# get the first page (zero-based)
+>>> paginator.get_page(0)
[Article 1, Article 2, Article 3, Article 4, Article 5]
# get the second page
@@ -45,7 +44,7 @@ API_TESTS = """
# does the first page have a next or previous page?
>>> paginator.has_next_page(0)
True
-
+
>>> paginator.has_previous_page(0)
False
@@ -55,5 +54,5 @@ False
>>> paginator.has_previous_page(1)
True
-
+
"""
diff --git a/tests/modeltests/transactions/models.py b/tests/modeltests/transactions/models.py
index 22f38f7a0c..ef7791c3f3 100644
--- a/tests/modeltests/transactions/models.py
+++ b/tests/modeltests/transactions/models.py
@@ -1,5 +1,5 @@
"""
-XXX. Transactions
+15. Transactions
Django handles transactions in three different ways. The default is to commit
each transaction upon a write, but you can decorate a function to get
diff --git a/tests/modeltests/validation/models.py b/tests/modeltests/validation/models.py
index d03fffea25..e5f85582b5 100644
--- a/tests/modeltests/validation/models.py
+++ b/tests/modeltests/validation/models.py
@@ -1,5 +1,7 @@
"""
-XX. Validation
+29. Validation
+
+This is an experimental feature!
Each model instance has a validate() method that returns a dictionary of
validation errors in the instance's fields. This method has a side effect