From e67dc0fbb2fc3d7c2c503b4cdc5b77ce4e944066 Mon Sep 17 00:00:00 2001 From: Vinay Karanam Date: Wed, 3 Jan 2018 12:07:29 +0530 Subject: [PATCH] Added tests for ArrayField.has_changed(). --- tests/postgres_tests/test_array.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py index 03ffa4d637..71d0603469 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -753,6 +753,13 @@ class TestSimpleFormField(PostgreSQLTestCase): vals = ['a', 'b', 'c'] self.assertEqual(field.clean(vals), vals) + def test_has_changed(self): + field = SimpleArrayField(forms.IntegerField()) + self.assertIs(field.has_changed([1, 2], [1, 2]), False) + self.assertIs(field.has_changed([1, 2], '1,2'), False) + self.assertIs(field.has_changed([1, 2], '1,2,3'), True) + self.assertIs(field.has_changed([1, 2], 'a,b'), True) + class TestSplitFormField(PostgreSQLTestCase):