diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2017-07-27 19:36:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-07-27 19:36:47 +0200 |
| commit | b61d5b1991e2ca2c3450ccc334224f3d51da39dc (patch) | |
| tree | 8cb9dee554eb78d43d69950dcf756d8eedac5d0d /tests | |
| parent | 14172cf4426de6c867028f1c194011c0a26e662d (diff) | |
Fixed #28371 -- Fixed Cast() with CharField if the max_length argument isn't provided.
Thanks Tim Graham for the review.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/db_functions/test_cast.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/db_functions/test_cast.py b/tests/db_functions/test_cast.py index bd4541bf06..e266a13db1 100644 --- a/tests/db_functions/test_cast.py +++ b/tests/db_functions/test_cast.py @@ -19,6 +19,10 @@ class CastTests(TestCase): numbers = Author.objects.annotate(cast_string=Cast('age', models.CharField(max_length=255)),) self.assertEqual(numbers.get().cast_string, '1') + def test_cast_to_char_field_without_max_length(self): + numbers = Author.objects.annotate(cast_string=Cast('age', models.CharField())) + self.assertEqual(numbers.get().cast_string, '1') + # Silence "Truncated incorrect CHAR(1) value: 'Bob'". @ignore_warnings(module='django.db.backends.mysql.base') @skipUnlessDBFeature('supports_cast_with_precision') |
