mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-10 21:34:18 +00:00
Merge pull request #79 from chriskuehl/requirements-sorter-nocase
Sort requirements.txt case-insensitively
This commit is contained in:
commit
616c1ebd18
2 changed files with 3 additions and 2 deletions
|
|
@ -19,8 +19,8 @@ class Requirement(object):
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return (
|
return (
|
||||||
self.value.partition(b'==') <
|
self.value.lower().partition(b'==') <
|
||||||
requirement.value.partition(b'==')
|
requirement.value.lower().partition(b'==')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ TESTS = (
|
||||||
(b'\nfoo\nbar\n', 1, b'bar\n\nfoo\n'),
|
(b'\nfoo\nbar\n', 1, b'bar\n\nfoo\n'),
|
||||||
(b'\nbar\nfoo\n', 0, b'\nbar\nfoo\n'),
|
(b'\nbar\nfoo\n', 0, b'\nbar\nfoo\n'),
|
||||||
(b'pyramid==1\npyramid-foo==2\n', 0, b'pyramid==1\npyramid-foo==2\n'),
|
(b'pyramid==1\npyramid-foo==2\n', 0, b'pyramid==1\npyramid-foo==2\n'),
|
||||||
|
(b'ocflib\nDjango\nPyMySQL\n', 1, b'Django\nocflib\nPyMySQL\n'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue