コード例 #1
0
def test_binary_file_count_detects_ignores_moved():
    parser = BinaryFileCount()
    input_stats = [
        FileDiffStat(
            'foo', [], [], Status.ALREADY_EXISTING,
            special_file=SpecialFile(SpecialFileType.BINARY, 'foo', 'foo'),
        ),
    ]

    assert not tuple(parser.get_metrics_from_stat(Commit.blank, input_stats))
コード例 #2
0
def test_binary_file_count_detects_added():
    parser = BinaryFileCount()
    input = [
        FileDiffStat(
            'foo', [], [], Status.ADDED,
            special_file=SpecialFile(SpecialFileType.BINARY, 'foo', None),
        ),
    ]

    metrics = list(parser.get_metrics_from_stat(input))
    assert metrics == [Metric('BinaryFileCount', 1)]
コード例 #3
0
def test_binary_file_count_detects_ignores_moved():
    parser = BinaryFileCount()
    input = [
        FileDiffStat(
            'foo', [], [], Status.ALREADY_EXISTING,
            special_file=SpecialFile(SpecialFileType.BINARY, 'foo', 'foo'),
        ),
    ]

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

    metric, = parser.get_metrics_from_stat(Commit.blank, input_stats)
    assert metric == Metric('BinaryFileCount', -1)
コード例 #5
0
def test_binary_file_count_detects_ignores_moved():
    parser = BinaryFileCount()
    input_stats = (FileDiffStat(
        b'foo',
        [],
        [],
        Status.ALREADY_EXISTING,
        special_file=SpecialFile(SpecialFileType.BINARY, b'foo', b'foo'),
    ), )

    assert not tuple(parser.get_metrics_from_stat(BLANK_COMMIT, input_stats))
コード例 #6
0
def test_binary_file_count_detects_added():
    parser = BinaryFileCount()
    input_stats = (FileDiffStat(
        b'foo',
        [],
        [],
        Status.ADDED,
        special_file=SpecialFile(SpecialFileType.BINARY, b'foo', None),
    ), )

    metric, = parser.get_metrics_from_stat(BLANK_COMMIT, input_stats)
    assert metric == Metric('BinaryFileCount', 1)
コード例 #7
0
def test_binary_file_count_detects_added():
    parser = BinaryFileCount()
    input_stats = [
        FileDiffStat(
            'foo',
            [],
            [],
            Status.ADDED,
            special_file=SpecialFile(SpecialFileType.BINARY, 'foo', None),
        ),
    ]

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