From 66cc18beb20d22344692209c4c242743ebd3ccf4 Mon Sep 17 00:00:00 2001 From: Gabriel Studer <gabriel.studer@unibas.ch> Date: Tue, 26 Nov 2019 08:57:40 +0100 Subject: [PATCH] Python 3 disallows overwriting class properties In Python 2, this assignment had the effect that the whole property (and it's lazy evaluation functionality) was completely overwritten and the private _chain_mapping was useless afterwards. Python 3 raises an AttributeError instead ("can't set attribute"). --- modules/mol/alg/tests/test_qsscoring.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/mol/alg/tests/test_qsscoring.py b/modules/mol/alg/tests/test_qsscoring.py index b8c31e22e..ad2620a2f 100644 --- a/modules/mol/alg/tests/test_qsscoring.py +++ b/modules/mol/alg/tests/test_qsscoring.py @@ -163,7 +163,8 @@ class TestQSscore(unittest.TestCase): # enforce different chain mapping enforced_cm = {'C': 'C', 'E': 'A', 'D': 'D', 'F': 'B'} qs_scorer_2 = QSscorer(qs_scorer.qs_ent_1, qs_scorer.qs_ent_2) - qs_scorer_2.chain_mapping = enforced_cm + # directly overwrite variable intended to be private. Have mercy with me. + qs_scorer_2._chain_mapping = enforced_cm self.assertAlmostEqual(qs_scorer_2.global_score, 0.356, 2) self.assertAlmostEqual(qs_scorer_2.best_score, 0.419, 2) self.assertEqual(qs_scorer_2.chain_mapping, enforced_cm) -- GitLab