@@ -361,16 +361,22 @@ def test_same_function_swap_args_3():
361361 assert compute_diff_sstub (test ) == SStubPattern .SAME_FUNCTION_SWAP_ARGS
362362
363363
364+ def bin_swaps (x ):
365+ for i in range (len (x ) - 1 ):
366+ for j in range (i + 1 , len (x )):
367+ result = list (x )
368+ result [i ], result [j ] = result [j ], result [i ]
369+ yield result
370+
371+
364372def test_same_function_swap_args_auto ():
365- import itertools
366373
367374 args = ["a" , "b" , "c" , "d + 1" , "0 if a != 0 else 1" ]
368375
369376 for l in range (2 , len (args )):
370377 perm = tuple (args [:l ])
371378
372- for p in itertools .permutations (perm ):
373- if p == perm : continue
379+ for p in bin_swaps (perm ):
374380
375381 test = """
376382@@ -0,0 +0,0 @@ test
@@ -1008,6 +1014,8 @@ def test_change_binary_operand_4():
10081014
10091015 assert compute_diff_sstub (test ) == SStubPattern .CHANGE_BINARY_OPERAND
10101016
1017+
1018+
10111019# Change attribute used ----------------------------------------------------------------
10121020
10131021
@@ -1394,16 +1402,16 @@ def test_more_specific_if_4():
13941402
13951403 """
13961404
1397- assert compute_diff_sstub (test ) = = SStubPattern .MORE_SPECIFIC_IF
1405+ assert compute_diff_sstub (test ) ! = SStubPattern .MORE_SPECIFIC_IF
13981406
13991407# Less specific if ------------------------------------------------------------------------
14001408
14011409def test_less_specific_if_1 ():
14021410 test = """
14031411@@ -0,0 +0,0 @@ test
14041412
1405- - if x and y :
1406- + if x:
1413+ - if x:
1414+ + if x or y :
14071415 pass
14081416
14091417 """
@@ -1441,21 +1449,8 @@ def test_less_specific_if_4():
14411449 test = """
14421450@@ -0,0 +0,0 @@ test
14431451
1444- - if x and test() or test2():
1445- + if x and test():
1446- pass
1447-
1448- """
1449-
1450- assert compute_diff_sstub (test ) == SStubPattern .LESS_SPECIFIC_IF
1451-
1452-
1453- def test_less_specific_if_5 ():
1454- test = """
1455- @@ -0,0 +0,0 @@ test
1456-
1457- - if x and test() or test2():
1458- + if x or test2():
1452+ - if x and test():
1453+ + if x and test() or test2():
14591454 pass
14601455
14611456 """
@@ -1513,4 +1508,4 @@ def test_real_world_3():
15131508
15141509 """
15151510
1516- assert compute_diff_sstub (test ) == SStubPattern .MORE_SPECIFIC_IF
1511+ assert compute_diff_sstub (test ) == SStubPattern .LESS_SPECIFIC_IF
0 commit comments