Merge pull request #205 from dlgallagher/fix_requirements_txt_fixer_on_empty_requirements_files

Fix NoneTypeError when requirements file is empty
This commit is contained in:
Anthony Sottile 2017-06-24 00:35:39 -04:00 committed by GitHub
commit d419bef35c
2 changed files with 13 additions and 8 deletions

View file

@ -5,6 +5,8 @@ from pre_commit_hooks.requirements_txt_fixer import Requirement
# Input, expected return value, expected output
TESTS = (
(b'', 0, b''),
(b'\n', 0, b'\n'),
(b'foo\nbar\n', 1, b'bar\nfoo\n'),
(b'bar\nfoo\n', 0, b'bar\nfoo\n'),
(b'#comment1\nfoo\n#comment2\nbar\n', 1, b'#comment2\nbar\n#comment1\nfoo\n'),