"""Tests for git parsing.""" import tempfile from pathlib import Path import pytest from termflow.parsers.git_parser import GitLogParser, Commit, WorkflowStats class TestGitLogParser: """Test git log parser.""" def test_is_git_repo_true(self, tmp_path): """Test detection of git repository.""" (tmp_path / ".git").mkdir() parser = GitLogParser(tmp_path) assert parser.is_git_repo() is True def test_is_git_repo_false(self, tmp_path): """Test detection of non-git directory.""" parser = GitLogParser(tmp_path) assert parser.is_git_repo() is False def test_parse_log_empty(self, tmp_path): """Test parsing empty git log.""" parser = GitLogParser(tmp_path) commits = parser.parse_log() assert commits == [] def test_analyze_workflow(self): """Test workflow analysis.""" parser = GitLogParser(Path.cwd()) stats = parser.analyze_workflow() assert isinstance(stats, WorkflowStats)