diff --git a/mocodo/rewrite/_grow.py b/mocodo/rewrite/_grow.py index f321500..9eb0062 100755 --- a/mocodo/rewrite/_grow.py +++ b/mocodo/rewrite/_grow.py @@ -105,7 +105,7 @@ def run(source, subargs=None, params=None, **kargs): while max_tries > 0: random.shuffle(arities) # Slightly push the non binary arities towards the end (one iteration of bubble sort). - # Reason: the non binary arities are tougher to place when there a not many entities yet + # Reason: the non binary arities are tougher to place when there are not many entities yet for i in range(len(arities) - 1): if arities[i] != 2 and arities[i + 1] == 2: (arities[i], arities[i + 1]) = (arities[i + 1], arities[i]) @@ -175,8 +175,8 @@ def run(source, subargs=None, params=None, **kargs): associations.append(new_association) counter += 1 for i in range(settings["n"] - settings["doubles"], settings["n"]): - old_refs = biased_choice(ref_pool) - arity = len(set(old_refs)) + refs = biased_choice(ref_pool) + arity = len(set(refs)) new_association = f"{association_bases[arity]} {counter}_" cards = calculate_cards(card_schemes[i], refs) clauses.append(", ".join([new_association] + [f"{card} {ref}" for (card, ref) in zip(cards, refs)])) diff --git a/test/test_rewrite_grow.py b/test/test_rewrite_grow.py index ef63087..71502cc 100644 --- a/test/test_rewrite_grow.py +++ b/test/test_rewrite_grow.py @@ -30,7 +30,7 @@ def test_default(self): Binary 15_, 11 Entity 14_, 01 Entity 10_ Entity 16_: id 16 1, attr 16 2 Binary 17_, 0N Entity 16_, 1N Entity 14_ - Binary 18_, 1N Entity 16_, 01 Entity 14_ + Binary 18_, 1N Entity 14_, 01 Entity 10_ """.replace(" ", "") self.assertEqual(actual.strip(), expected.strip())