<s> import unittest <EOL> from test . asserting . policy import PolicyAssertion , get_fixture_path <EOL> from vint . linting . level import Level <EOL> from vint . linting . policy . prohibit_command_with_unintended_side_effect import ProhibitCommandWithUnintendedSideEffect <EOL> PATH_VALID_VIM_SCRIPT = get_fixture_path ( '<STR_LIT>' ) <EOL> PATH_INVALID_VIM_SCRIPT = get_fixture_path ( '<STR_LIT>' ) <EOL> class TestProhibitCommandWithUnintendedSideEffect ( PolicyAssertion , unittest . TestCase ) : <EOL> def _create_violation_by_line_number ( self , line_number ) : <EOL> return { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : Level . WARNING , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : line_number , <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT:path>' : PATH_INVALID_VIM_SCRIPT <EOL> } <EOL> } <EOL> def test_get_violation_if_found_with_valid_file ( self ) : <EOL> self . assertFoundNoViolations ( PATH_VALID_VIM_SCRIPT , <EOL> ProhibitCommandWithUnintendedSideEffect ) <EOL> def test_get_violation_if_found_with_invalid_file ( self ) : <EOL> expected_violations = [ self . _create_violation_by_line_number ( line_number ) <EOL> for line_number in range ( <NUM_LIT:1> , <NUM_LIT> ) ] <EOL> expected_violations [ <NUM_LIT:3> ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] = <NUM_LIT:2> <EOL> expected_violations [ <NUM_LIT:4> ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] = <NUM_LIT:6> <EOL> self . assertFoundViolationsEqual ( PATH_INVALID_VIM_SCRIPT , <EOL> ProhibitCommandWithUnintendedSideEffect , <EOL> expected_violations ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
