<s> import os . path <EOL> import pytest <EOL> from pre_commit_hooks . requirements_txt_fixer import fix_requirements_txt <EOL> from pre_commit_hooks . requirements_txt_fixer import Requirement <EOL> TESTS = ( <EOL> ( b'<STR_LIT>' , <NUM_LIT:1> , b'<STR_LIT>' ) , <EOL> ( b'<STR_LIT>' , <NUM_LIT:0> , b'<STR_LIT>' ) , <EOL> ( b'<STR_LIT>' , <NUM_LIT:1> , b'<STR_LIT>' ) , <EOL> ( b'<STR_LIT>' , <NUM_LIT:0> , b'<STR_LIT>' ) , <EOL> ( b'<STR_LIT>' , <NUM_LIT:1> , b'<STR_LIT>' ) , <EOL> ( b'<STR_LIT>' , <NUM_LIT:0> , b'<STR_LIT>' ) , <EOL> ( b'<STR_LIT>' , <NUM_LIT:1> , b'<STR_LIT>' ) , <EOL> ( b'<STR_LIT>' , <NUM_LIT:0> , b'<STR_LIT>' ) , <EOL> ( b'<STR_LIT>' , <NUM_LIT:0> , b'<STR_LIT>' ) , <EOL> ( b'<STR_LIT>' , <NUM_LIT:1> , b'<STR_LIT>' ) , <EOL> ) <EOL> @ pytest . mark . parametrize ( ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , TESTS ) <EOL> def test_integration ( input_s , expected_retval , output , tmpdir ) : <EOL> path = os . path . join ( tmpdir . strpath , '<STR_LIT>' ) <EOL> with open ( path , '<STR_LIT:wb>' ) as file_obj : <EOL> file_obj . write ( input_s ) <EOL> assert fix_requirements_txt ( [ path ] ) == expected_retval <EOL> assert open ( path , '<STR_LIT:rb>' ) . read ( ) == output <EOL> def test_requirement_object ( ) : <EOL> top_of_file = Requirement ( ) <EOL> top_of_file . comments . append ( '<STR_LIT>' ) <EOL> top_of_file . value = b'<STR_LIT:\n>' <EOL> requirement_foo = Requirement ( ) <EOL> requirement_foo . value = b'<STR_LIT:foo>' <EOL> requirement_bar = Requirement ( ) <EOL> requirement_bar . value = b'<STR_LIT:bar>' <EOL> assert requirement_foo > top_of_file <EOL> assert top_of_file < requirement_foo <EOL> assert requirement_foo > requirement_bar <EOL> assert requirement_bar < requirement_foo </s>
