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))
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))
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)]
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)]
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)
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)]
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)
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)]