Refactoring, test coverage increased to 60% (#1943)

This commit is contained in:
Soxoj
2024-12-08 02:13:28 +01:00
committed by GitHub
parent 4b1317789d
commit c66d776f8a
19 changed files with 326 additions and 226 deletions
+34
View File
@@ -0,0 +1,34 @@
import pytest
from maigret.permutator import Permute
def test_gather_strict():
elements = {'a': 1, 'b': 2}
permute = Permute(elements)
result = permute.gather(method="strict")
expected = {
'a_b': 1, 'b_a': 2,
'a-b': 1, 'b-a': 2,
'a.b': 1, 'b.a': 2,
'ab': 1, 'ba': 2,
'_ab': 1, 'ab_': 1,
'_ba': 2, 'ba_': 2
}
assert result == expected
def test_gather_all():
elements = {'a': 1, 'b': 2}
permute = Permute(elements)
result = permute.gather(method="all")
expected = {
'a': 1, '_a': 1, 'a_': 1,
'b': 2, '_b': 2, 'b_': 2,
'a_b': 1, 'b_a': 2,
'a-b': 1, 'b-a': 2,
'a.b': 1, 'b.a': 2,
'ab': 1, 'ba': 2,
'_ab': 1, 'ab_': 1,
'_ba': 2, 'ba_': 2
}
assert result == expected