Ticket #5079: 5079.2.diff

File 5079.2.diff, 866 bytes (added by Philippe Raoult, 17 years ago)

added the correct regression tests (works for me though)

  • tests/modeltests/basic/models.py

     
    66"""
    77
    88from django.db import models
     9from decimal import Decimal
    910
    1011class Article(models.Model):
    1112    headline = models.CharField(max_length=100, default='Default headline')
     
    1718    def __unicode__(self):
    1819        return self.headline
    1920
     21class DecimalTest(models.Model):
     22    field = models.DecimalField(max_digits=40, decimal_places=30)
     23   
    2024__test__ = {'API_TESTS': """
     25>>> b1 = DecimalTest(field=Decimal(".1"))
     26>>> b1.field
     27Decimal("0.1")
     28>>> b1.save()
     29>>> b1.field
     30Decimal("0.1")
     31>>> DecimalTest.objects.get(id=1).field
     32Decimal("0.1")
     33
    2134# No articles are in the system yet.
    2235>>> Article.objects.all()
    2336[]
Back to Top