Skip to content

Commit 7c4947a

Browse files
committed
💄 style(tests): remove extra blank lines and fix formatting
1 parent 61808b6 commit 7c4947a

3 files changed

Lines changed: 20 additions & 26 deletions

File tree

tests/unit/test_changelog.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,25 +1160,19 @@ def test_tgit_commit_with_bytes_message_encoding_error(self):
11601160
"""Test TGITCommit with bytes message that has encoding issues."""
11611161
mock_repo = Mock()
11621162
mock_repo.git.rev_parse.return_value = "abc1234"
1163-
1163+
11641164
mock_commit = Mock()
11651165
mock_commit.message = "feat: test message" # Use valid UTF-8 string since bytes handling is in get_commits
11661166
mock_commit.author.name = "Test Author"
11671167
mock_commit.author.email = "test@example.com"
11681168
mock_commit.committed_datetime = Mock()
11691169
mock_commit.hexsha = "abcdef123456"
1170-
1171-
message_dict = {
1172-
"emoji": "✨",
1173-
"type": "feat",
1174-
"scope": None,
1175-
"description": "test message",
1176-
"breaking": None
1177-
}
1178-
1170+
1171+
message_dict = {"emoji": "✨", "type": "feat", "scope": None, "description": "test message", "breaking": None}
1172+
11791173
# This should handle the commit creation properly
11801174
tgit_commit = TGITCommit(mock_repo, mock_commit, message_dict)
1181-
1175+
11821176
# Should not raise an exception and should have the correct properties
11831177
assert tgit_commit.type == "feat"
11841178
assert tgit_commit.description == "test message"
@@ -1188,10 +1182,10 @@ def test_get_remote_uri_safe_basic(self):
11881182
"""Test _get_remote_uri_safe basic functionality."""
11891183
mock_repo = Mock()
11901184
mock_repo.remote.side_effect = ValueError("No remote found")
1191-
1185+
11921186
# Should return None when no remote is found
11931187
result = _get_remote_uri_safe(mock_repo)
1194-
1188+
11951189
assert result is None
11961190

11971191
def test_extract_latest_tag_from_changelog_malformed_file(self, tmp_path):
@@ -1203,9 +1197,9 @@ def test_extract_latest_tag_from_changelog_malformed_file(self, tmp_path):
12031197
This is not a proper changelog
12041198
No version tags here
12051199
""")
1206-
1200+
12071201
result = extract_latest_tag_from_changelog(str(changelog_file))
1208-
1202+
12091203
# Should return None for malformed changelog
12101204
assert result is None
12111205

@@ -1214,7 +1208,7 @@ def test_commit_pattern_with_unicode_message(self):
12141208
# Test with unicode characters in commit message
12151209
message = "feat: add 中文 支持 for internationalization"
12161210
match = commit_pattern.match(message)
1217-
1211+
12181212
assert match is not None
12191213
assert match.group("type") == "feat"
12201214
assert "中文 支持" in match.group("description")

tests/unit/test_commit.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -561,28 +561,28 @@ class TestCommitErrorHandling:
561561
def test_handle_commit_no_message(self, mock_get_ai_command):
562562
"""Test handle_commit with no message provided."""
563563
args = CommitArgs(message=[], emoji=False, breaking=False, ai=False)
564-
564+
565565
# Mock get_ai_command to return None (no AI command generated)
566566
mock_get_ai_command.return_value = None
567-
567+
568568
# This should call get_ai_command and return early when it returns None
569569
handle_commit(args)
570-
570+
571571
# Should have called get_ai_command
572572
mock_get_ai_command.assert_called_once()
573573

574574
def test_get_file_change_sizes_binary_files(self):
575575
"""Test get_file_change_sizes with binary files."""
576576
mock_repo = Mock()
577577
mock_repo.git.diff.return_value = "-\t-\timage.png\n5\t0\tfile.py\n-\t-\tbinary.dat"
578-
578+
579579
result = get_file_change_sizes(mock_repo)
580-
580+
581581
# Should handle binary files (marked with -/-) as 0 size
582582
expected = {
583583
"image.png": 0, # Binary files treated as 0 size
584584
"file.py": 5,
585-
"binary.dat": 0
585+
"binary.dat": 0,
586586
}
587587
assert result == expected
588588

@@ -593,9 +593,9 @@ def test_get_changed_files_from_status_renamed_files(self, mock_repo_class):
593593
mock_repo.git.diff.return_value = """R100\told_name.py\tnew_name.py
594594
R100\tdir/old.js\tdir/new.js
595595
M\tmodified.py"""
596-
596+
597597
result = get_changed_files_from_status(mock_repo)
598-
598+
599599
# Should include both old and new names of renamed files and modified files
600600
expected = {"old_name.py", "new_name.py", "dir/old.js", "dir/new.js", "modified.py"}
601601
assert result == expected

tests/unit/test_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,9 @@ def test_load_settings_basic_functionality(self, tmp_path):
255255
tgit_dir.mkdir()
256256
config_file = tgit_dir / "settings.json"
257257
config_file.write_text(json.dumps({"apiKey": "test_key", "model": "gpt-4"}))
258-
258+
259259
with patch("tgit.utils.Path.cwd", return_value=tmp_path):
260260
result = load_workspace_settings()
261-
261+
262262
assert result["apiKey"] == "test_key"
263263
assert result["model"] == "gpt-4"

0 commit comments

Comments
 (0)