コード例 #1
0
def test_get_commits_last_modified_lines_hyper_blame(repo: Git):
    buggy_commits = repo.get_commits_last_modified_lines(repo.get_commit(
        'e6d3b38a9ef683e8184eac10a0471075c2808bbd'))

    assert len(buggy_commits) == 1
    assert '540c7f31c18664a38190fafb6721b5174ff4a166' in buggy_commits[
        'B.java']
def test_get_commits_last_modified_lines_rename(repo: Git):
    buggy_commits = repo.get_commits_last_modified_lines(
        repo.get_commit('2f2d0dec7cd06de4c2ed11ed010727a54af8ebf8'))

    assert len(buggy_commits) == 1
    assert '00e61714fd76ff110d8da953aa1179809591f5aa' in buggy_commits[str(
        Path('myfolder/Z.java'))]
def test_get_commits_last_modified_lines_rename_and_fix(repo: Git):
    buggy_commits = repo.get_commits_last_modified_lines(
        repo.get_commit('4e287ab8e6dba110219404fb8a43993f3dda674c'))

    assert len(buggy_commits) == 1
    assert '06b9ff31cd3475d9fd9ef668cc0844ab169da726' in buggy_commits[
        'H.java']
コード例 #4
0
def test_get_commits_last_modified_lines_hyper_blame_with_renaming(repo: Git):
    buggy_commits = repo.get_commits_last_modified_lines(repo.get_commit(
        'be0772cbaa2eba32bf97aae885199d1a357ddc93'))

    assert len(buggy_commits) == 2
    assert '9568d20856728304ab0b4d2d02fb9e81d0e5156d' in buggy_commits[
        'A.java']
    assert '9568d20856728304ab0b4d2d02fb9e81d0e5156d' in buggy_commits[
        'H.java']
コード例 #5
0
def test_get_commits_last_modified_lines_hyper_blame_unblamable(tmp_path, repo: Git):
    p = tmp_path / "ignore.txt"
    p.write_text("540c7f31c18664a38190fafb6721b5174ff4a166")

    buggy_commits = repo.get_commits_last_modified_lines(repo.get_commit(
        'e6d3b38a9ef683e8184eac10a0471075c2808bbd'),
        hashes_to_ignore_path=str(p))

    assert len(buggy_commits) == 0
コード例 #6
0
def test_get_commits_last_modified_lines_multiple(repo: Git):
    buggy_commits = repo.get_commits_last_modified_lines(repo.get_commit('9942ee9dcdd1103e5808d544a84e6bc8cade0e54'))

    assert len(buggy_commits) == 1
    assert '2eb905e5e7be414fd184d6b4f1571b142621f4de' in buggy_commits[
        'A.java']
    assert '20a40688521c1802569e60f9d55342c3bfdd772c' in buggy_commits[
        'A.java']
    assert '22505e97dca6f843549b3a484b3609be4e3acf17' in buggy_commits[
        'A.java']
コード例 #7
0
def test_get_commits_last_modified_lines_hyper_blame_ignore_hash(tmp_path, repo: Git):
    p = tmp_path / "ignore.txt"
    p.write_text("5cb9e9ae44a0949ec91d06a955975289be766f34")

    buggy_commits = repo.get_commits_last_modified_lines(repo.get_commit(
        'c7002fb321a8ba32a28fac200538f7c2ba76f175'),
        hashes_to_ignore_path=str(p))

    assert len(buggy_commits) == 1
    assert 'c41d270f8abc203c895309235adbd5f3f81d4a45' in buggy_commits[
        'A.java']
コード例 #8
0
def test_get_commits_last_modified_lines_for_single_file(repo: Git):
    commit = repo.get_commit('0f726924f96621e4965039123098ba83e39ffba6')
    buggy_commits = None
    for mod in commit.modified_files:
        if mod.filename == 'A.java':
            buggy_commits = repo.get_commits_last_modified_lines(commit, mod)

    assert buggy_commits
    assert len(buggy_commits) == 1
    assert 'e2ed043eb96c05ebde653a44ae733ded9ef90750' in buggy_commits['A.java']
    assert 1 == len(buggy_commits['A.java'])
コード例 #9
0
def test_get_commits_last_modified_lines_with_more_modification(repo: Git):
    buggy_commits = repo.get_commits_last_modified_lines(repo.get_commit('c7002fb321a8ba32a28fac200538f7c2ba76f175'))
    assert len(buggy_commits) == 1
    assert '5cb9e9ae44a0949ec91d06a955975289be766f34' in buggy_commits[
        'A.java']
コード例 #10
0
def test_get_commits_last_modified_lines_useless_lines2(repo: Git):
    buggy_commits = repo.get_commits_last_modified_lines(repo.get_commit('4155c421ee5cbb3c34feee7b68aa78a2ee1bbeae'))
    assert len(buggy_commits) == 0
コード例 #11
0
def test_get_commits_last_modified_lines_useless_lines(repo: Git):
    buggy_commits = repo.get_commits_last_modified_lines(repo.get_commit('3bc7295c16b7dfc15d5f82eb6962a2774e1b8420'))
    assert len(buggy_commits) == 1
    assert 'c7fc2e870ce03b0b8dc29ed0eeb26d14e235ea3b' in buggy_commits[
        'H.java']