1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
Description: fix test failed
modify the relevant parts in test/test01.py to be compatible with
Python 3.12
Author: Yue Gui <yuemeng.gui@gmail.com>
Bug-Debian: https://bugs.debian.org/1081639
Forwarded: no
Reviewed-by: Étienne Mollier <emollier@debian.org>
Last-Update: 2024-09-13
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- python-freecontact.orig/test/test01.py
+++ python-freecontact/test/test01.py
@@ -17,7 +17,6 @@
#
import freecontact
import unittest
-from test import test_support
class MyTestCase1(unittest.TestCase):
@@ -43,9 +42,9 @@
assert fcp.dbg == True
def test3(self):
- EXAMPLE = open('examples/demo_1000.aln', 'r')
- aln = EXAMPLE.readlines(); aln = map(lambda s: s.rstrip(), aln)
- EXAMPLE.close()
+ with open('examples/demo_1000.aln') as EXAMPLE:
+ aln = EXAMPLE.readlines()
+ aln = list(map(lambda s: s.rstrip(), aln))
num_threads = 1
evfold_24_42 = 0.0129471030086279 # 0-based indices
@@ -80,8 +79,7 @@
assert abs(res['fro'][2741][2] - evfold_24_42) / evfold_24_42 < prec_threshold
def test_main():
- test_support.run_unittest(MyTestCase1
- )
+ unittest.main()
if __name__ == '__main__':
test_main()
|