mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-03-29 10:16:52 +00:00
Remove duplicated elements
This commit is contained in:
parent
516a8a263c
commit
670f16c2f7
2 changed files with 4 additions and 1 deletions
|
|
@ -116,7 +116,8 @@ def fix_requirements(f: IO[bytes]) -> int:
|
|||
for requirement in sorted(requirements):
|
||||
after.extend(requirement.comments)
|
||||
assert requirement.value, requirement.value
|
||||
after.append(requirement.value)
|
||||
if requirement.value not in after:
|
||||
after.append(requirement.value)
|
||||
after.extend(rest)
|
||||
|
||||
after_string = b''.join(after)
|
||||
|
|
|
|||
|
|
@ -99,6 +99,8 @@ from pre_commit_hooks.requirements_txt_fixer import Requirement
|
|||
PASS,
|
||||
b'a=2.0.0 \\\n --hash=sha256:abcd\nb==1.0.0\n',
|
||||
),
|
||||
(b'\nfoo\nfoo\n', FAIL, b'\nfoo\n'),
|
||||
(b'\nbar\nfoo\nbar\n', FAIL, b'\nbar\nfoo\n'),
|
||||
),
|
||||
)
|
||||
def test_integration(input_s, expected_retval, output, tmpdir):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue