<s> """<STR_LIT>""" <EOL> import mock <EOL> import pytest <EOL> from pyramid_swagger . ingest import compile_swagger_schema <EOL> from pyramid_swagger . ingest import get_resource_listing <EOL> from pyramid_swagger . model import PathNotMatchedError <EOL> from pyramid_swagger . model import partial_path_match <EOL> @ pytest . fixture <EOL> def schema ( ) : <EOL> schema_dir = '<STR_LIT>' <EOL> return compile_swagger_schema ( <EOL> schema_dir , <EOL> get_resource_listing ( schema_dir , False ) <EOL> ) <EOL> def test_swagger_schema_for_request_different_methods ( schema ) : <EOL> """<STR_LIT>""" <EOL> value = schema . validators_for_request ( <EOL> request = mock . Mock ( <EOL> path = "<STR_LIT>" , <EOL> method = "<STR_LIT:GET>" <EOL> ) , <EOL> ) <EOL> assert value . body . schema is None <EOL> value = schema . validators_for_request ( <EOL> request = mock . Mock ( <EOL> path = "<STR_LIT>" , <EOL> method = "<STR_LIT:POST>" , <EOL> body = { '<STR_LIT:foo>' : <NUM_LIT:1> , '<STR_LIT:bar>' : <NUM_LIT:2> } , <EOL> ) , <EOL> ) <EOL> assert value . body . schema == { <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT:name>' : '<STR_LIT:content>' , <EOL> '<STR_LIT>' : '<STR_LIT:body>' , <EOL> '<STR_LIT:type>' : '<STR_LIT>' , <EOL> } <EOL> def test_swagger_schema_for_request_not_found ( schema ) : <EOL> """<STR_LIT>""" <EOL> with pytest . raises ( PathNotMatchedError ) as excinfo : <EOL> schema . validators_for_request ( <EOL> request = mock . Mock ( <EOL> path = "<STR_LIT>" , <EOL> method = "<STR_LIT:GET>" <EOL> ) , <EOL> ) <EOL> assert '<STR_LIT>' in str ( excinfo ) <EOL> assert '<STR_LIT>' in str ( excinfo ) <EOL> def test_partial_path_match ( ) : <EOL> assert partial_path_match ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ) <EOL> assert partial_path_match ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ) <EOL> assert not partial_path_match ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ) </s>
