summaryrefslogtreecommitdiff
path: root/tests/regressiontests/inline_formsets/models.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2010-10-14 01:40:39 +0000
committerAlex Gaynor <alex.gaynor@gmail.com>2010-10-14 01:40:39 +0000
commite50066d0b59fd106272357f5747d6f4f33b47751 (patch)
treef5f6783073306ab01e99e2ec5b1cda95cd99cc4d /tests/regressiontests/inline_formsets/models.py
parent14419f916bbbe8017976b19a3bcf7d45e0f30f64 (diff)
[1.2.X] Fixed #14456 -- converted inline_formsets tests from doctests to unittests. We have always been at war with doctests. Thanks to prestontimmons for the patch. Backport of [14212].
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14213 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/inline_formsets/models.py')
-rw-r--r--tests/regressiontests/inline_formsets/models.py44
1 files changed, 1 insertions, 43 deletions
diff --git a/tests/regressiontests/inline_formsets/models.py b/tests/regressiontests/inline_formsets/models.py
index 9b1f8b4932..d76eea758b 100644
--- a/tests/regressiontests/inline_formsets/models.py
+++ b/tests/regressiontests/inline_formsets/models.py
@@ -1,6 +1,7 @@
# coding: utf-8
from django.db import models
+
class School(models.Model):
name = models.CharField(max_length=100)
@@ -25,46 +26,3 @@ class Poem(models.Model):
def __unicode__(self):
return self.name
-
-__test__ = {'API_TESTS': """
-
->>> from django.forms.models import inlineformset_factory
-
-
-Child has two ForeignKeys to Parent, so if we don't specify which one to use
-for the inline formset, we should get an exception.
-
->>> ifs = inlineformset_factory(Parent, Child)
-Traceback (most recent call last):
- ...
-Exception: <class 'regressiontests.inline_formsets.models.Child'> has more than 1 ForeignKey to <class 'regressiontests.inline_formsets.models.Parent'>
-
-
-These two should both work without a problem.
-
->>> ifs = inlineformset_factory(Parent, Child, fk_name='mother')
->>> ifs = inlineformset_factory(Parent, Child, fk_name='father')
-
-
-If we specify fk_name, but it isn't a ForeignKey from the child model to the
-parent model, we should get an exception.
-
->>> ifs = inlineformset_factory(Parent, Child, fk_name='school')
-Traceback (most recent call last):
- ...
-Exception: fk_name 'school' is not a ForeignKey to <class 'regressiontests.inline_formsets.models.Parent'>
-
-
-If the field specified in fk_name is not a ForeignKey, we should get an
-exception.
-
->>> ifs = inlineformset_factory(Parent, Child, fk_name='test')
-Traceback (most recent call last):
- ...
-Exception: <class 'regressiontests.inline_formsets.models.Child'> has no field named 'test'
-
-
-# Regression test for #9171.
->>> ifs = inlineformset_factory(Parent, Child, exclude=('school',), fk_name='mother')
-"""
-}