Skip to content

Commit 621bc5a

Browse files
committed
fix tests
1 parent b37dcb4 commit 621bc5a

File tree

2 files changed

+41
-38
lines changed

2 files changed

+41
-38
lines changed

plagcheck/plagcheck.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ def __extract_info(self) -> Results:
7474
filename2, perc2 = col2.text.strip().split()
7575

7676
with ThreadPoolExecutor() as executor:
77-
future = executor.submit(
78-
self.__get_line_numbers, col1.a.get("href"))
77+
future = executor.submit(self.__get_line_numbers, col1.a.get("href"))
7978
lines = future.result()
8079

8180
result_dict = Result(
@@ -139,8 +138,8 @@ def getShareScores(self):
139138
"""Share Score Insights"""
140139
similar_code_files = []
141140
for result in self.moss_results:
142-
similar_code_files.append(result['file1'])
143-
similar_code_files.append(result['file2'])
141+
similar_code_files.append(result["file1"])
142+
similar_code_files.append(result["file2"])
144143

145144
# frequency of files which are similar
146145
share_score = collections.Counter(similar_code_files)
@@ -154,16 +153,14 @@ def getInsights(self):
154153
insights = {}
155154

156155
for r in self.moss_results:
157-
similar_code_files.add(r['file1'])
158-
similar_code_files.add(r['file2'])
156+
similar_code_files.add(r["file1"])
157+
similar_code_files.add(r["file2"])
159158

160159
mg.createNodes(similar_code_files)
161160

162161
for r in self.moss_results:
163162
mg.relatesTo(
164-
r['percentage_file1'],
165-
r['percentage_file2'],
166-
r['file1'], r['file2']
163+
r["percentage_file1"], r["percentage_file2"], r["file1"], r["file2"]
167164
)
168165

169166
mg.set_tags()

plagcheck/plagcheck_test.py

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,39 @@ def test_check():
1414
insights = temp.getInsights()
1515
share_scores = temp.getShareScores()
1616

17-
assert share_scores == {'testfiles/test_python.py': 2,
18-
'testfiles/test_python2.py': 2,
19-
'testfiles/test_python3.py': 2}
17+
assert share_scores == {
18+
"testfiles/test_python.py": 2,
19+
"testfiles/test_python2.py": 2,
20+
"testfiles/test_python3.py": 2,
21+
}
2022

21-
assert insights == {
22-
'DCtoC Paths': [],
23-
'DtoC Paths': [],
24-
'DtoDC Paths': []}
23+
assert insights == {"DCtoC Paths": [], "DtoC Paths": [], "DtoDC Paths": []}
2524

2625
assert results == [
27-
{'file1': 'testfiles/test_python2.py',
28-
'file2': 'testfiles/test_python3.py',
29-
'lines_matched': [['1-3', '1-3']],
30-
'no_of_lines_matched': 3,
31-
'percentage_file1': 90,
32-
'percentage_file2': 90},
33-
{'file1': 'testfiles/test_python.py',
34-
'file2': 'testfiles/test_python3.py',
35-
'lines_matched': [['1-3', '1-3']],
36-
'no_of_lines_matched': 3,
37-
'percentage_file1': 90,
38-
'percentage_file2': 90},
39-
{'file1': 'testfiles/test_python.py',
40-
'file2': 'testfiles/test_python2.py',
41-
'lines_matched': [['1-3', '1-3']],
42-
'no_of_lines_matched': 3,
43-
'percentage_file1': 90,
44-
'percentage_file2': 90}
26+
{
27+
"file1": "testfiles/test_python2.py",
28+
"file2": "testfiles/test_python3.py",
29+
"lines_matched": [["1-3", "1-3"]],
30+
"no_of_lines_matched": 3,
31+
"percentage_file1": 90,
32+
"percentage_file2": 90,
33+
},
34+
{
35+
"file1": "testfiles/test_python.py",
36+
"file2": "testfiles/test_python3.py",
37+
"lines_matched": [["1-3", "1-3"]],
38+
"no_of_lines_matched": 3,
39+
"percentage_file1": 90,
40+
"percentage_file2": 90,
41+
},
42+
{
43+
"file1": "testfiles/test_python.py",
44+
"file2": "testfiles/test_python2.py",
45+
"lines_matched": [["1-3", "1-3"]],
46+
"no_of_lines_matched": 3,
47+
"percentage_file1": 90,
48+
"percentage_file2": 90,
49+
},
4550
]
4651

4752

@@ -56,14 +61,15 @@ def test_perc_str_to_int():
5661

5762

5863
def test_Mgroups():
64+
"""Test Mgroups()"""
5965
mg = analyze.Mgroups()
60-
mg.createNodes({'1', '2', '3'})
66+
mg.createNodes({"1", "2", "3"})
6167

62-
mg.relatesTo(45, 88, '3', '1')
63-
mg.relatesTo(46, 90, '3', '2')
68+
mg.relatesTo(45, 88, "3", "1")
69+
mg.relatesTo(46, 90, "3", "2")
6470

6571
mg.set_tags()
6672

6773
assert mg.d2dc() == []
68-
assert mg.d2c() == [('3', '1'), ('3', '2')]
74+
assert mg.d2c() == [("3", "1"), ("3", "2")]
6975
assert mg.dc2c() == []

0 commit comments

Comments
 (0)