コード例 #1
0
def test_submodule_count_detects_ignores_moved():
    parser = SubmoduleCount()
    input_stats = [
        FileDiffStat(
            'foo', [], [], Status.ALREADY_EXISTING,
            special_file=SpecialFile(SpecialFileType.SUBMODULE, 'bar', 'baz'),
        ),
    ]

    assert not tuple(parser.get_metrics_from_stat(Commit.blank, input_stats))
コード例 #2
0
def test_submodule_count_detects_ignores_moved():
    parser = SubmoduleCount()
    input_stats = (
        FileDiffStat(
            b'foo', [], [], Status.ALREADY_EXISTING,
            special_file=SpecialFile(SpecialFileType.SUBMODULE, b'br', b'bz'),
        ),
    )

    assert not tuple(parser.get_metrics_from_stat(BLANK_COMMIT, input_stats))
コード例 #3
0
def test_submodule_count_detects_ignores_moved():
    parser = SubmoduleCount()
    input_stats = [
        FileDiffStat(
            'foo', [], [], Status.ALREADY_EXISTING,
            special_file=SpecialFile(SpecialFileType.SUBMODULE, 'bar', 'baz'),
        ),
    ]

    metrics = list(parser.get_metrics_from_stat(input_stats))
    assert metrics == [Metric('SubmoduleCount', 0)]
コード例 #4
0
def test_submodule_count_detects_deleted():
    parser = SubmoduleCount()
    input_stats = [
        FileDiffStat(
            'foo', [], [], Status.DELETED,
            special_file=SpecialFile(SpecialFileType.SUBMODULE, None, 'bar'),
        ),
    ]

    metrics = list(parser.get_metrics_from_stat(input_stats))
    assert metrics == [Metric('SubmoduleCount', -1)]
コード例 #5
0
def test_submodule_count_detects_added():
    parser = SubmoduleCount()
    input_stats = [
        FileDiffStat(
            'foo', [], [], Status.ADDED,
            special_file=SpecialFile(SpecialFileType.SUBMODULE, 'bar', None),
        ),
    ]

    metric, = parser.get_metrics_from_stat(Commit.blank, input_stats)
    assert metric == Metric('SubmoduleCount', 1)
コード例 #6
0
def test_submodule_count_detects_added():
    parser = SubmoduleCount()
    input = [
        FileDiffStat(
            'foo', [], [], Status.ADDED,
            special_file=SpecialFile(SpecialFileType.SUBMODULE, 'bar', None),
        ),
    ]

    metrics = list(parser.get_metrics_from_stat(input))
    assert metrics == [Metric('SubmoduleCount', 1)]
コード例 #7
0
def test_submodule_count_detects_added():
    parser = SubmoduleCount()
    input_stats = (
        FileDiffStat(
            b'foo', [], [], Status.ADDED,
            special_file=SpecialFile(SpecialFileType.SUBMODULE, b'bar', None),
        ),
    )

    metric, = parser.get_metrics_from_stat(BLANK_COMMIT, input_stats)
    assert metric == Metric('SubmoduleCount', 1)
コード例 #8
0
def test_submodule_count_detects_ignores_moved():
    parser = SubmoduleCount()
    input_stats = [
        FileDiffStat(
            'foo',
            [],
            [],
            Status.ALREADY_EXISTING,
            special_file=SpecialFile(SpecialFileType.SUBMODULE, 'bar', 'baz'),
        ),
    ]

    metrics = list(parser.get_metrics_from_stat(input_stats))
    assert metrics == [Metric('SubmoduleCount', 0)]
コード例 #9
0
def test_submodule_count_detects_deleted():
    parser = SubmoduleCount()
    input_stats = [
        FileDiffStat(
            'foo',
            [],
            [],
            Status.DELETED,
            special_file=SpecialFile(SpecialFileType.SUBMODULE, None, 'bar'),
        ),
    ]

    metrics = list(parser.get_metrics_from_stat(input_stats))
    assert metrics == [Metric('SubmoduleCount', -1)]
コード例 #10
0
def test_submodule_count_detects_added():
    parser = SubmoduleCount()
    input_stats = [
        FileDiffStat(
            'foo',
            [],
            [],
            Status.ADDED,
            special_file=SpecialFile(SpecialFileType.SUBMODULE, 'bar', None),
        ),
    ]

    metrics = list(parser.get_metrics_from_stat(Commit.blank, input_stats))
    assert metrics == [Metric('SubmoduleCount', 1)]