MCPcopy Create free account
hub / github.com/Persper/code-analytics / test_patch_parser

Function test_patch_parser

test/test_analytics/test_detect_change.py:51–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49
50
51def test_patch_parser():
52 parser = PatchParser()
53
54 patch2_truth = (
55 [[0, 6]],
56 []
57 )
58 with open(os.path.join(dir_path, 'example2.patch'), 'r') as f:
59 example2_patch = f.read()
60 parsing_result = parser.parse(example2_patch)
61 assert(parsing_result == patch2_truth)
62
63 # view patch3_truth here
64 # https://github.com/UltimateBeaver/test_feature_branch/commit/caaac10f604ea7ac759c2147df8fb2b588ee2a27
65 patch3_truth = (
66 [[10, 4], [12, 1], [14, 1], [17, 13]],
67 [[9, 10], [12, 12], [14, 14]]
68 )
69 with open(os.path.join(dir_path, 'example3.patch'), 'r') as f:
70 example3_patch = f.read()
71 parsing_result = parser.parse(example3_patch)
72 assert(parsing_result == patch3_truth)
73
74 # view patch4_truth here
75 # https://github.com/UltimateBeaver/test_feature_branch/commit/364d5cc49aeb2e354da458924ce84c0ab731ac77
76 patch4_truth = (
77 [[0, 27]],
78 []
79 )
80 with open(os.path.join(dir_path, 'example4.patch'), 'r') as f:
81 example4_patch = f.read()
82 parsing_result = parser.parse(example4_patch)
83 assert(parsing_result == patch4_truth)
84
85
86def test_no_newline_at_the_end_of_file():

Callers

nothing calls this directly

Calls 2

parseMethod · 0.95
PatchParserClass · 0.90

Tested by

no test coverage detected