diff options
Diffstat (limited to 'tests/regressiontests/model_fields')
| -rw-r--r-- | tests/regressiontests/model_fields/tests.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/regressiontests/model_fields/tests.py b/tests/regressiontests/model_fields/tests.py index e279a0669f..c2ba9ee008 100644 --- a/tests/regressiontests/model_fields/tests.py +++ b/tests/regressiontests/model_fields/tests.py @@ -15,4 +15,21 @@ Decimal("3.14") Traceback (most recent call last): ... ValidationError: [u'This value must be a decimal number.'] + +>>> f = DecimalField(max_digits=5, decimal_places=1) +>>> x = f.to_python(2) +>>> y = f.to_python('2.6') + +>>> f.get_db_prep_save(x) +u'2.0' +>>> f.get_db_prep_save(y) +u'2.6' +>>> f.get_db_prep_save(None) +>>> f.get_db_prep_lookup('exact', x) +[u'2.0'] +>>> f.get_db_prep_lookup('exact', y) +[u'2.6'] +>>> f.get_db_prep_lookup('exact', None) +[None] + """ |
