Skip to content

Commit

Permalink
Parameterize test_looks_like_hash() (#6650)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdaBehan authored and pradyunsg committed Jul 5, 2019
1 parent 005f700 commit 8e26b83
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Empty file added news/1234.trivial
Empty file.
17 changes: 10 additions & 7 deletions tests/unit/test_vcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,17 @@ def test_rev_options_make_new():
assert new_options.vc_class is Git


def test_looks_like_hash():
assert looks_like_hash(40 * 'a')
assert looks_like_hash(40 * 'A')
@pytest.mark.parametrize('sha, expected', [
((40 * 'a'), True),
((40 * 'A'), True),
# Test a string containing all valid characters.
assert looks_like_hash(18 * 'a' + '0123456789abcdefABCDEF')
assert not looks_like_hash(40 * 'g')
assert not looks_like_hash(39 * 'a')
assert not looks_like_hash(41 * 'a')
((18 * 'a' + '0123456789abcdefABCDEF'), True),
((40 * 'g'), False),
((39 * 'a'), False),
((41 * 'a'), False)
])
def test_looks_like_hash(sha, expected):
assert looks_like_hash(sha) == expected


@pytest.mark.parametrize('vcs_cls, remote_url, expected', [
Expand Down

0 comments on commit 8e26b83

Please sign in to comment.