Skip to content
Snippets Groups Projects
Commit 66cc18be authored by Studer Gabriel's avatar Studer Gabriel
Browse files

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").
parent cbe33a36
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment