Fixed #7920 -- Made tests compatible with Python 2.6's Decimal repr change, patch from Karen Tracey.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8190 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Gary Wilson Jr 2008-08-02 04:48:14 +00:00
parent a500ade891
commit cbbd54d5cd
2 changed files with 42 additions and 38 deletions

View file

@ -1,15 +1,19 @@
"""
>>> from django.db.models.fields import *
>>> try:
... from decimal import Decimal
... except ImportError:
... from django.utils._decimal import Decimal
# DecimalField
>>> f = DecimalField(max_digits=4, decimal_places=2)
>>> f.to_python(3)
Decimal("3")
>>> f.to_python(3) == Decimal("3")
True
>>> f.to_python("3.14")
Decimal("3.14")
>>> f.to_python("3.14") == Decimal("3.14")
True
>>> f.to_python("abc")
Traceback (most recent call last):