From 0c9a75b7cf79ba038d401f3818d91bcc1ba167a8 Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Tue, 21 Jul 2020 09:16:27 +0200
Subject: [PATCH] relax unit test for HHblits search

Probability values of hits in HHblits searches using tag v3.2.0 and
the current master branch differ. We therefore only check whether we
find the expected number of hits and check their score in the hope
that the HHblits scores stay consistent in future HHblits releases.
---
 modules/bindings/tests/test_hhblits.py | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/modules/bindings/tests/test_hhblits.py b/modules/bindings/tests/test_hhblits.py
index 836a3a78d..305e67511 100644
--- a/modules/bindings/tests/test_hhblits.py
+++ b/modules/bindings/tests/test_hhblits.py
@@ -268,15 +268,12 @@ class TestHHblitsBindings(unittest.TestCase):
         search_file = self.hh.Search("testfiles/testali.a3m",
                                      'testfiles/hhblitsdb/unittestdb')
 
-        with open(search_file) as tfh:
-          tlst = tfh.readlines()
-        with open("testfiles/test_two.hhr") as efh:
-          elst = efh.readlines()
-
-        self.assertEqual(len(elst), len(tlst))
-        for i in range(0, len(elst)):
-            if not elst[i].startswith(('Date', 'Command')):
-                self.assertEqual(elst[i], tlst[i])
+        with open(search_file) as f:
+              header, hits = hhblits.ParseHHblitsOutput(f)
+        self.assertEqual(len(hits), 4)
+        exp_scores = [199.3, 12.3, 11.5, 8.1]
+        for hit_idx in range(4):
+            self.assertAlmostEqual(hits[hit_idx].score, exp_scores[hit_idx])
 
     def testSearchNotWorking(self):
         query_seq = seq.CreateSequence('Test', 'VLSPADKTNVKAAWGKVGAHAGEYGAEA'+
-- 
GitLab