mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user