Freddy Rolland has posted comments on this change. Change subject: iscsi: Add ChapCredentials equality and hash tests ......................................................................
Patch Set 1: Code-Review+1 (2 comments) https://gerrit.ovirt.org/#/c/43989/1/tests/iscsiTests.py File tests/iscsiTests.py: Line 106: diffrent diffrent->different Line 106: def test_subclass_diffrent_hash(self): : class Subclass(iscsi.ChapCredentials): : pass : c1 = iscsi.ChapCredentials("username", ProtectedPassword("password")) : c2 = Subclass("username", ProtectedPassword("password")) : self.assertNotEqual(hash(c1), hash(c2)) : : @permutations([ : ("a", "a", "a", "b"), : ("a", "b", "a", "a"), : ]) : def test_not_equal_different_hash(self, user1, user2, pass1, pass2): : c1 = iscsi.ChapCredentials(user1, ProtectedPassword(pass1)) : c2 = iscsi.ChapCredentials(user2, ProtectedPassword(pass2)) : self.assertNotEqual(hash(c1), hash(c2)) Why do we need this tests ? I thought the contract should be: 1. If two objects are equal, then they must have the same hash code. 2. If two objects have the same hashcode, they may or may not be equal. -- To view, visit https://gerrit.ovirt.org/43989 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7f3fde727c179936ba480f5b4cf4c24cacb195b8 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer <[email protected]> Gerrit-Reviewer: Ala Hino <[email protected]> Gerrit-Reviewer: Allon Mureinik <[email protected]> Gerrit-Reviewer: Dan Kenigsberg <[email protected]> Gerrit-Reviewer: Freddy Rolland <[email protected]> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
