mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
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:
parent
a500ade891
commit
cbbd54d5cd
2 changed files with 42 additions and 38 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue