From a34cb9eb4f1abd4d5d2e37e67837071b7dd3346a Mon Sep 17 00:00:00 2001 From: Coos Baakman Date: Thu, 1 Apr 2021 14:05:48 +0000 Subject: [PATCH] test uniqueness of pair objects too! --- test/models/test_pair.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/test/models/test_pair.py b/test/models/test_pair.py index b7d02036..fd7e1b25 100644 --- a/test/models/test_pair.py +++ b/test/models/test_pair.py @@ -1,15 +1,31 @@ -from nose.tools import eq_ +from nose.tools import eq_, ok_ from deeprank.models.pair import Pair def test_order_independency(): - # test comparing: + # These should be the same: pair1 = Pair(1, 2) pair2 = Pair(2, 1) + + # test comparing: eq_(pair1, pair2) # test hashing: d = {pair1: 1} d[pair2] = 2 eq_(d[pair1], 2) + + +def test_uniqueness(): + # These should be different: + pair1 = Pair(1, 2) + pair2 = Pair(1, 3) + + # test comparing: + ok_(pair1 != pair2) + + # test hashing: + d = {pair1: 1} + d[pair2] = 2 + eq_(d[pair1], 1)