Sort requirements.txt case-insensitively
diff --git a/pre_commit_hooks/requirements_txt_fixer.py b/pre_commit_hooks/requirements_txt_fixer.py
index cc09242..bf7f75d 100644
--- a/pre_commit_hooks/requirements_txt_fixer.py
+++ b/pre_commit_hooks/requirements_txt_fixer.py
@@ -19,8 +19,8 @@
return False
else:
return (
- self.value.partition(b'==') <
- requirement.value.partition(b'==')
+ self.value.lower().partition(b'==') <
+ requirement.value.lower().partition(b'==')
)
diff --git a/tests/requirements_txt_fixer_test.py b/tests/requirements_txt_fixer_test.py
index 3eac637..3680733 100644
--- a/tests/requirements_txt_fixer_test.py
+++ b/tests/requirements_txt_fixer_test.py
@@ -16,6 +16,7 @@
(b'\nfoo\nbar\n', 1, b'bar\n\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'ocflib\nDjango\nPyMySQL\n', 1, b'Django\nocflib\nPyMySQL\n'),
)