Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dce9f70

Browse files
test(init): add yaml not a dict test case
1 parent ab8a459 commit dce9f70

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

‎tests/commands/test_init_command.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,19 @@ def test_pre_commit_config_yaml_without_repos(_, default_choice, tmpdir, config)
226226
# Should use DEFAULT_CONFIG since the file content doesn't have 'repos' key
227227
check_pre_commit_config([CZ_HOOK_CONFIG])
228228

229+
def test_pre_commit_config_yaml_not_a_dict(_, default_choice, tmpdir, config):
230+
with tmpdir.as_cwd():
231+
# Write a dictionary YAML content without 'repos' key
232+
p = tmpdir.join(PRE_COMMIT_CONFIG_FILENAME)
233+
p.write(
234+
yaml.safe_dump(["item1", "item2"])
235+
) # Dictionary without 'repos' key
236+
237+
commands.Init(config)()
238+
check_cz_config(default_choice)
239+
# Should use DEFAULT_CONFIG since the file content doesn't have 'repos' key
240+
check_pre_commit_config([CZ_HOOK_CONFIG])
241+
229242
def test_cz_hook_exists_in_pre_commit_config(_, default_choice, tmpdir, config):
230243
with tmpdir.as_cwd():
231244
p = tmpdir.join(PRE_COMMIT_CONFIG_FILENAME)

‎tests/test_git.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ def test_get_commits_with_signature():
276276

277277
def test_get_tag_names_has_correct_arrow_annotation():
278278
arrow_annotation = inspect.getfullargspec(git.get_tag_names).annotations["return"]
279+
279280
assert arrow_annotation == "list[str]"
280281

281282

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /