Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
test uniqueness of pair objects too!
Browse files Browse the repository at this point in the history
  • Loading branch information
Coos Baakman committed Apr 1, 2021
1 parent 8d9cb1b commit a34cb9e
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions test/models/test_pair.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit a34cb9e

Please sign in to comment.