summaryrefslogtreecommitdiff
path: root/tests/regressiontests/model_fields/models.py
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2009-04-10 19:56:56 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2009-04-10 19:56:56 +0000
commit7a283f790cabfbd95a51ed0fe06f274f7c49c04d (patch)
tree8582da5885fcab711af22fa1639907b56f44d0ef /tests/regressiontests/model_fields/models.py
parent1a541eebd35f7ce6da7e9074db6c66e0b0393ac5 (diff)
[1.0.X] Converted model_fields regression tests into unittests. Backport of r10499 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10501 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/model_fields/models.py')
-rw-r--r--tests/regressiontests/model_fields/models.py63
1 files changed, 1 insertions, 62 deletions
diff --git a/tests/regressiontests/model_fields/models.py b/tests/regressiontests/model_fields/models.py
index 6948fe51a5..43ef667d00 100644
--- a/tests/regressiontests/model_fields/models.py
+++ b/tests/regressiontests/model_fields/models.py
@@ -1,4 +1,3 @@
-
from django.db import models
try:
@@ -37,64 +36,4 @@ class BigD(models.Model):
d = models.DecimalField(max_digits=38, decimal_places=30)
class BigS(models.Model):
- s = models.SlugField(max_length=255)
-
-__test__ = {'API_TESTS':"""
-# Create a couple of Places.
->>> f = Foo.objects.create(a='abc', d=decimal.Decimal("12.34"))
->>> f.id
-1
->>> b = Bar(b = "bcd")
->>> b.a
-<Foo: Foo object>
->>> b.save()
-
-# Regression tests for #7913
-# Check that get_choices and get_flatchoices interact with
-# get_FIELD_display to return the expected values.
-
-# Test a nested value
->>> w = Whiz(c=1)
->>> w.save()
->>> w.get_c_display()
-u'First'
-
-# Test a top level value
->>> w.c = 0
->>> w.get_c_display()
-u'Other'
-
-# Test an invalid data value
->>> w.c = 9
->>> w.get_c_display()
-9
-
-# Test a blank data value
->>> w.c = None
->>> print w.get_c_display()
-None
-
-# Test an empty data value
->>> w.c = ''
->>> w.get_c_display()
-u''
-
-# Regression test for #8023: should be able to filter decimal fields using
-# strings (which is what gets passed through from, e.g., the admin interface).
->>> Foo.objects.filter(d=u'1.23')
-[]
-
-# Regression test for #5079 -- ensure decimals don't go through a corrupting
-# float conversion during save.
->>> bd = BigD(d="12.9")
->>> bd.save()
->>> bd = BigD.objects.get(pk=bd.pk)
->>> bd.d == decimal.Decimal("12.9")
-True
-
-# Regression test for #9706: ensure SlugField honors max_length.
->>> bs = BigS.objects.create(s = 'slug' * 50)
->>> bs = BigS.objects.get(pk=bs.pk)
->>> bs.s == 'slug' * 50
-True
-"""}
+ s = models.SlugField(max_length=255) \ No newline at end of file