[Python-modules-commits] [django-picklefield] 05/15: compare objects by fields not by instance

Michael Fladischer fladi at moszumanska.debian.org
Thu Mar 31 20:34:09 UTC 2016


This is an automated email from the git hooks/post-receive script.

fladi pushed a commit to tag debian/0.3.2-1
in repository django-picklefield.

commit 94f24d0f022b4c5835fa35a3d7cafaceebe47f99
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Thu Oct 8 08:55:32 2015 -0700

    compare objects by fields not by instance
    
     Upstream tests are comparing the original object directly with the deserialized
     one. This fails because the default python comparison for objects uses their
     identity which fails for two different object instances.
     This patch does the comparison by field for both objects.
    Last-Update: 2014-08-29
    Forwarded: https://github.com/shrubberysoft/django-picklefield/pull/16
    
    Patch-Name: fix_tests.patch
---
 src/picklefield/tests.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/picklefield/tests.py b/src/picklefield/tests.py
index 2430b21..4e88ee2 100644
--- a/src/picklefield/tests.py
+++ b/src/picklefield/tests.py
@@ -166,4 +166,7 @@ class PickledObjectFieldTests(TestCase):
         ])
 
         for deserialized_test in serializers.deserialize('json', serialized):
-            self.assertEqual(deserialized_test.object, model)
+            self.assertEquals(deserialized_test.object.pk,
+                              model.pk)
+            self.assertEquals(deserialized_test.object.pickle_field,
+                              model.pickle_field)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-picklefield.git



More information about the Python-modules-commits mailing list