本文整理匯總了Python中reverser.RSRReverser.prune_options方法的典型用法代碼示例。如果您正苦於以下問題:Python RSRReverser.prune_options方法的具體用法?Python RSRReverser.prune_options怎麽用?Python RSRReverser.prune_options使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類reverser.RSRReverser
的用法示例。
在下文中一共展示了RSRReverser.prune_options方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_rsrreverser_prune_options_some
# 需要導入模塊: from reverser import RSRReverser [as 別名]
# 或者: from reverser.RSRReverser import prune_options [as 別名]
def test_rsrreverser_prune_options_some():
reverser = RSRReverser('/test[/{option1}][/{option2}][/{option3}]')
params = {
'option2': 'some',
}
pruned_route = '/test/{option2}'
assert reverser.prune_options(params) == pruned_route
示例2: test_rsrreverser_prune_options_nested_incomplete
# 需要導入模塊: from reverser import RSRReverser [as 別名]
# 或者: from reverser.RSRReverser import prune_options [as 別名]
def test_rsrreverser_prune_options_nested_incomplete():
reverser = RSRReverser('/test[/{option1}[/{option2}]][/{option3}]')
params = {
'option1': 'incomplete_nest',
'option3': 'prune',
}
pruned_route = '/test/{option1}/{option3}'
assert reverser.prune_options(params) == pruned_route
示例3: test_rsrreverser_prune_options_nested_no_parent
# 需要導入模塊: from reverser import RSRReverser [as 別名]
# 或者: from reverser.RSRReverser import prune_options [as 別名]
def test_rsrreverser_prune_options_nested_no_parent():
reverser = RSRReverser('/test[/{option1}[/{option2}]][/{option3}]')
params = {
'option2': 'no_parent_nest',
'option3': 'prune',
}
pruned_route = '/test/{option3}'
assert reverser.prune_options(params) == pruned_route
示例4: test_rsrreverser_prune_options_invalid
# 需要導入模塊: from reverser import RSRReverser [as 別名]
# 或者: from reverser.RSRReverser import prune_options [as 別名]
def test_rsrreverser_prune_options_invalid():
reverser = RSRReverser('/test[/{_o1}][/{o2;}][/{o^3}]')
params = {
'_o1': 'invalid',
'o2;': 'but',
'o^3': 'subs',
}
pruned_route = '/test/{_o1}/{o2;}/{o^3}'
assert reverser.prune_options(params) == pruned_route
示例5: test_rsrreverser_prune_options_full
# 需要導入模塊: from reverser import RSRReverser [as 別名]
# 或者: from reverser.RSRReverser import prune_options [as 別名]
def test_rsrreverser_prune_options_full():
reverser = RSRReverser('/test[/{option1}][/{option2}][/{option3}]')
params = {
'option1': 'options',
'option2': 'are',
'option3': 'fun',
}
pruned_route = '/test/{option1}/{option2}/{option3}'
assert reverser.prune_options(params) == pruned_route
示例6: test_rsrreverser_prune_options_nested_custom
# 需要導入模塊: from reverser import RSRReverser [as 別名]
# 或者: from reverser.RSRReverser import prune_options [as 別名]
def test_rsrreverser_prune_options_nested_custom():
route = '/test</=option1;</=option2;</=option3;>>>'
reverser = RSRReverser(route, option_bounds='<>', param_bounds='=;')
params = {
'option1': 'custom',
'option2': 'bounds',
'option3': 'are_fun',
}
pruned_route = '/test/=option1;/=option2;/=option3;'
assert reverser.prune_options(params) == pruned_route
示例7: test_rsrreverser_prune_options_unsafe
# 需要導入模塊: from reverser import RSRReverser [as 別名]
# 或者: from reverser.RSRReverser import prune_options [as 別名]
def test_rsrreverser_prune_options_unsafe():
reverser = RSRReverser('/test[/{option1}][/{option2}][/{option3}]')
params = {
'param1': 'nothing',
'param2': 'to',
'param3': 'see',
'param4': 'here',
}
pruned_route = '/test'
assert reverser.prune_options(params) == pruned_route