diff options
| author | Derek Anderson <public@kered.org> | 2006-10-26 19:09:51 +0000 |
|---|---|---|
| committer | Derek Anderson <public@kered.org> | 2006-10-26 19:09:51 +0000 |
| commit | 42851d90dadbf62f5d342ce5c4f496ba1eeba987 (patch) | |
| tree | a5d0e5c178afb2d7dbb7bf5ab37db9ced42f4b52 /tests/modeltests/basic | |
| parent | 450889c9a6f7da3c2fce77a0ccf4c4cea9e29710 (diff) | |
committing to schema-evolution
merge from HEAD
git-svn-id: http://code.djangoproject.com/svn/django/branches/schema-evolution@3937 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests/basic')
| -rw-r--r-- | tests/modeltests/basic/models.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/modeltests/basic/models.py b/tests/modeltests/basic/models.py index 78d943eb97..5638865f31 100644 --- a/tests/modeltests/basic/models.py +++ b/tests/modeltests/basic/models.py @@ -13,8 +13,7 @@ class Article(models.Model): def __str__(self): return self.headline -API_TESTS = """ - +__test__ = {'API_TESTS': """ # No articles are in the system yet. >>> Article.objects.all() [] @@ -87,6 +86,10 @@ DoesNotExist: Article matching query does not exist. >>> Article.objects.get(pk=1) <Article: Area woman programs in Python> +# pk can be used as a shortcut for the primary key name in any query +>>> Article.objects.filter(pk__in=[1]) +[<Article: Area woman programs in Python>] + # Model instances of the same type and same ID are considered equal. >>> a = Article.objects.get(pk=1) >>> b = Article.objects.get(pk=1) @@ -314,14 +317,14 @@ AttributeError: Manager isn't accessible via Article instances >>> Article.objects.all() [<Article: Article 6>, <Article: Default headline>, <Article: Article 7>, <Article: Updated article 8>] -""" +"""} from django.conf import settings building_docs = getattr(settings, 'BUILDING_DOCS', False) if building_docs or settings.DATABASE_ENGINE == 'postgresql': - API_TESTS += """ + __test__['API_TESTS'] += """ # In PostgreSQL, microsecond-level precision is available. >>> a9 = Article(headline='Article 9', pub_date=datetime(2005, 7, 31, 12, 30, 45, 180)) >>> a9.save() @@ -330,7 +333,7 @@ datetime.datetime(2005, 7, 31, 12, 30, 45, 180) """ if building_docs or settings.DATABASE_ENGINE == 'mysql': - API_TESTS += """ + __test__['API_TESTS'] += """ # In MySQL, microsecond-level precision isn't available. You'll lose # microsecond-level precision once the data is saved. >>> a9 = Article(headline='Article 9', pub_date=datetime(2005, 7, 31, 12, 30, 45, 180)) @@ -339,7 +342,7 @@ if building_docs or settings.DATABASE_ENGINE == 'mysql': datetime.datetime(2005, 7, 31, 12, 30, 45) """ -API_TESTS += """ +__test__['API_TESTS'] += """ # You can manually specify the primary key when creating a new object. >>> a101 = Article(id=101, headline='Article 101', pub_date=datetime(2005, 7, 31, 12, 30, 45)) |
