From d5ac4ae7c10b064f785b5b66838c3f11c4b038c0 Mon Sep 17 00:00:00 2001
From: Melvin Alappat <melvin.alappat@unibas.ch>
Date: Wed, 5 Jan 2022 12:55:24 +0100
Subject: [PATCH] additional check in pytest

---
 tests/test_priming_prob.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tests/test_priming_prob.py b/tests/test_priming_prob.py
index 2be04d6..5c1ba5b 100644
--- a/tests/test_priming_prob.py
+++ b/tests/test_priming_prob.py
@@ -29,7 +29,17 @@ def test_inter_prob():
     mytestfile = open(Output_file, "r")  # Test whether gff file start with transcript ID
     for mylinecounter in mytestfile:
         assert mylinecounter.startswith("NW_005196756.1:c68260-66684")
+    mytestfile.close()
 
     with open(Output_file, "r") as tt:  # Check whether number of interactions is right
         x = len(tt.readlines())
         assert x == 3
+
+    prob = open(Output_file, "r")  # check if the sum of the probabilities is 1
+    lines = prob.readlines()
+    probabilities = []
+    for x in lines:
+        probabilities.append(float(x.split('\t')[5]))
+    prob.close()
+
+    assert sum(probabilities) == 1  # sum should equal 1
-- 
GitLab