<s> from flask_apispec . paths import rule_to_path , rule_to_params <EOL> def make_rule ( app , path , ** kwargs ) : <EOL> @ app . route ( path , ** kwargs ) <EOL> def view ( ) : <EOL> pass <EOL> return app . url_map . _rules_by_endpoint [ '<STR_LIT>' ] [ <NUM_LIT:0> ] <EOL> def make_param ( ** kwargs ) : <EOL> ret = { '<STR_LIT>' : '<STR_LIT:path>' , '<STR_LIT>' : True } <EOL> ret . update ( kwargs ) <EOL> return ret <EOL> class TestPaths : <EOL> def test_path ( self , app ) : <EOL> rule = make_rule ( app , '<STR_LIT>' ) <EOL> assert rule_to_path ( rule ) == '<STR_LIT>' <EOL> def test_path_int ( self , app ) : <EOL> rule = make_rule ( app , '<STR_LIT>' ) <EOL> assert rule_to_path ( rule ) == '<STR_LIT>' <EOL> class TestPathParams : <EOL> def test_params ( self , app ) : <EOL> rule = make_rule ( app , '<STR_LIT>' ) <EOL> params = rule_to_params ( rule ) <EOL> assert len ( params ) == <NUM_LIT:1> <EOL> expected = make_param ( type = '<STR_LIT:string>' , name = '<STR_LIT>' ) <EOL> assert params [ <NUM_LIT:0> ] == expected <EOL> def test_params_default ( self , app ) : <EOL> rule = make_rule ( app , '<STR_LIT>' , defaults = { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> params = rule_to_params ( rule ) <EOL> expected = make_param ( type = '<STR_LIT:string>' , name = '<STR_LIT>' , default = '<STR_LIT>' ) <EOL> assert params [ <NUM_LIT:0> ] == expected <EOL> def test_params_int ( self , app ) : <EOL> rule = make_rule ( app , '<STR_LIT>' ) <EOL> params = rule_to_params ( rule ) <EOL> expected = make_param ( type = '<STR_LIT>' , format = '<STR_LIT>' , name = '<STR_LIT>' ) <EOL> assert params [ <NUM_LIT:0> ] == expected <EOL> def test_params_float ( self , app ) : <EOL> rule = make_rule ( app , '<STR_LIT>' ) <EOL> params = rule_to_params ( rule ) <EOL> expected = make_param ( type = '<STR_LIT>' , format = '<STR_LIT:float>' , name = '<STR_LIT>' ) <EOL> assert params [ <NUM_LIT:0> ] == expected <EOL> def test_params_override ( self , app ) : <EOL> rule = make_rule ( app , '<STR_LIT>' ) <EOL> overrides = { '<STR_LIT>' : { '<STR_LIT:description>' : '<STR_LIT>' } } <EOL> params = rule_to_params ( rule , overrides = overrides ) <EOL> expected = make_param ( type = '<STR_LIT:string>' , name = '<STR_LIT>' , description = '<STR_LIT>' ) <EOL> assert params [ <NUM_LIT:0> ] == expected </s>
