diff options
| author | Brandon Chinn <brandonchinn178@gmail.com> | 2016-11-11 17:07:31 -0800 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-11-15 18:43:55 -0500 |
| commit | eed615000903ec7b659c3563b7b4b4b3f34f5636 (patch) | |
| tree | 388341ebb4eca26fe435d464a6b27ee61b5d5574 /tests/postgres_tests | |
| parent | 6573274161ee589e89077192239e0bd01cbd692a (diff) | |
Refs #27003 -- Fixed JSONField crash on converted values.
Diffstat (limited to 'tests/postgres_tests')
| -rw-r--r-- | tests/postgres_tests/test_json.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_json.py b/tests/postgres_tests/test_json.py index 78dded31a9..9691329a49 100644 --- a/tests/postgres_tests/test_json.py +++ b/tests/postgres_tests/test_json.py @@ -365,3 +365,13 @@ class TestFormField(PostgreSQLTestCase): field = CustomJSONField() self.assertIsInstance(field.widget, widgets.Input) + + def test_already_converted_value(self): + field = forms.JSONField(required=False) + tests = [ + '["a", "b", "c"]', '{"a": 1, "b": 2}', '1', '1.5', '"foo"', + 'true', 'false', 'null', + ] + for json_string in tests: + val = field.clean(json_string) + self.assertEqual(field.clean(val), val) |
