Skip to content

Commit 49a59b6

Browse files
committed
Update setup.py for the full release
1 parent b88acbb commit 49a59b6

File tree

4 files changed

+22
-27
lines changed

4 files changed

+22
-27
lines changed

code_diff/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from code_tokenize.config import load_from_lang_config
1+
from code_tokenize.lang import load_from_lang_config
22
from code_tokenize.tokens import match_type
33

44
from .ast import parse_ast

code_diff/ast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import code_tokenize as ct
1+
import code_ast as ct
22

33
from collections import defaultdict
44

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55

66
setup(
77
name = 'code_diff',
8-
packages = ['code_diff'],
9-
version = '0.1.0',
8+
packages = ['code_diff', 'code_diff.gumtree'],
9+
version = '0.1.1',
1010
license='MIT',
1111
description = 'Fast AST based code differencing in Python',
1212
long_description = long_description,
1313
long_description_content_type="text/markdown",
1414
author = 'Cedric Richter',
1515
author_email = '[email protected]',
1616
url = 'https://github.com/cedricrupb/code_diff',
17-
download_url = 'https://github.com/cedricrupb/code_diff/archive/refs/tags/v0.1.0.tar.gz',
17+
download_url = 'https://github.com/cedricrupb/code_diff/archive/refs/tags/v0.1.1.tar.gz',
1818
keywords = ['code', 'differencing', 'AST', 'program', 'language processing'],
1919
install_requires=[
2020
'code-tokenize',

tests/test_sstubs.py

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
364372
def 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

14011409
def 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

Comments
 (0)