|
3 | 3 |
|
4 | 4 | def test_basic_hash(script, tmpdir):
|
5 | 5 | """Run 'pip hash' through its default behavior."""
|
6 |
| - expected = ('--hash=sha256:2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425' |
7 |
| - 'e73043362938b9824') |
8 |
| - result = script.pip('hash', _hello_file(tmpdir)) |
| 6 | + expected = ( |
| 7 | + "--hash=sha256:2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425" |
| 8 | + "e73043362938b9824" |
| 9 | + ) |
| 10 | + result = script.pip("hash", _hello_file(tmpdir)) |
9 | 11 | assert expected in str(result)
|
10 | 12 |
|
11 | 13 |
|
12 | 14 | def test_good_algo_option(script, tmpdir):
|
13 | 15 | """Make sure the -a option works."""
|
14 |
| - expected = ('--hash=sha512:9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caad' |
15 |
| - 'ae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e' |
16 |
| - '5c3adef46f73bcdec043') |
17 |
| - result = script.pip('hash', '-a', 'sha512', _hello_file(tmpdir)) |
| 16 | + expected = ( |
| 17 | + "--hash=sha512:9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caad" |
| 18 | + "ae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e" |
| 19 | + "5c3adef46f73bcdec043" |
| 20 | + ) |
| 21 | + result = script.pip("hash", "-a", "sha512", _hello_file(tmpdir)) |
18 | 22 | assert expected in str(result)
|
19 | 23 |
|
20 | 24 |
|
21 | 25 | def test_bad_algo_option(script, tmpdir):
|
22 | 26 | """Make sure the -a option raises an error when given a bad operand."""
|
23 |
| - result = script.pip('hash', '-a', 'invalidname', _hello_file(tmpdir), |
24 |
| - expect_error=True) |
| 27 | + result = script.pip( |
| 28 | + "hash", "-a", "invalidname", _hello_file(tmpdir), expect_error=True |
| 29 | + ) |
25 | 30 | assert "invalid choice: 'invalidname'" in str(result)
|
26 | 31 |
|
27 | 32 |
|
28 | 33 | def _hello_file(tmpdir):
|
29 | 34 | """Return a temp file to hash containing "hello"."""
|
30 |
| - file = tmpdir / 'hashable' |
31 |
| - file.write_text('hello') |
| 35 | + file = tmpdir / "hashable" |
| 36 | + file.write_text("hello") |
32 | 37 | return file
|
0 commit comments