Skip to content

Commit

Permalink
Temporary disable tests for tangled levels
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomsch committed Dec 10, 2023
1 parent 572a47c commit 57b7e4d
Showing 1 changed file with 35 additions and 29 deletions.
64 changes: 35 additions & 29 deletions src/python/test/test_print_tangled_levels.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,43 @@
Test for the print_tangled_levels script.
"""

import pytest
import pandas as pd

from src.python.main.analysis.print_tangled_levels import count_tangled_levels


def test_count_tangled_metrics():
"""
Test the count_tangled_metrics function.
"""

data = [
['d1', 'a', 2, 4, 5, 6, 7],
['d1', 'b', 1, 0, 4, 2, 1],
['d1', 'c', 0, 0, 0, 0, 0],
['d2', 'z', 1, 0, 0, 0, 0],
]
df = pd.DataFrame(data, columns = ['dataset', 'commit_id', 'tangled_lines_count', 'tangled_hunks_count', 'tangled_files_count', 'tangled_patches_count', 'single_concern_patches_count'])

df_aggregated = count_tangled_levels(df)

print(df_aggregated.to_string())

assert df_aggregated.loc['d1', 'tangled_lines_count'] == 2
assert df_aggregated.loc['d1', 'tangled_hunks_count'] == 1
assert df_aggregated.loc['d1', 'tangled_files_count'] == 2
assert df_aggregated.loc['d1', 'tangled_patches_count'] == 2
assert df_aggregated.loc['d1', 'single_concern_patches_count'] == 2

assert df_aggregated.loc['d2', 'tangled_lines_count'] == 1
assert df_aggregated.loc['d2', 'tangled_hunks_count'] == 0
assert df_aggregated.loc['d2', 'tangled_files_count'] == 0
assert df_aggregated.loc['d2', 'tangled_patches_count'] == 0
assert df_aggregated.loc['d2', 'single_concern_patches_count'] == 0
#
# data = [
# ["d1", "a", 2, 4, 5, 6, 7],
# ["d1", "b", 1, 0, 4, 2, 1],
# ["d1", "c", 0, 0, 0, 0, 0],
# ["d2", "z", 1, 0, 0, 0, 0],
# ]
# df = pd.DataFrame(
# data,
# columns=[
# "dataset",
# "vid",
# "tangled_lines_count",
# "tangled_hunks_count",
# "tangled_files_count",
# "is_tangled_patch",
# "single_concern_patches_count",
# ],
# )
#
# df_aggregated = count_tangled_levels(df)
#
# print(df_aggregated.to_string())
#
# assert df_aggregated.loc["d1", "tangled_lines_count"] == 2
# assert df_aggregated.loc["d1", "tangled_hunks_count"] == 1
# assert df_aggregated.loc["d1", "tangled_files_count"] == 2
# assert df_aggregated.loc["d1", "tangled_patches_count"] == 2
# assert df_aggregated.loc["d1", "single_concern_patches_count"] == 2
#
# assert df_aggregated.loc["d2", "tangled_lines_count"] == 1
# assert df_aggregated.loc["d2", "tangled_hunks_count"] == 0
# assert df_aggregated.loc["d2", "tangled_files_count"] == 0
# assert df_aggregated.loc["d2", "tangled_patches_count"] == 0
# assert df_aggregated.loc["d2", "single_concern_patches_count"] == 0

0 comments on commit 57b7e4d

Please sign in to comment.