本文整理匯總了Python中webob.acceptparse.Accept._match方法的典型用法代碼示例。如果您正苦於以下問題:Python Accept._match方法的具體用法?Python Accept._match怎麽用?Python Accept._match使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類webob.acceptparse.Accept
的用法示例。
在下文中一共展示了Accept._match方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_accept_match
# 需要導入模塊: from webob.acceptparse import Accept [as 別名]
# 或者: from webob.acceptparse.Accept import _match [as 別名]
def test_accept_match():
accept = Accept('Content-Type', 'text/html')
#FIXME: Accept._match should be standalone function _match that is
# attached as Accept._match during Accept.__init__.
assert accept._match('*', 'text/html')
assert accept._match('text/html', 'text/html')
assert accept._match('TEXT/HTML', 'text/html')
assert not accept._match('foo/bar', 'text/html')
示例2: test_accept_match_lang
# 需要導入模塊: from webob.acceptparse import Accept [as 別名]
# 或者: from webob.acceptparse.Accept import _match [as 別名]
def test_accept_match_lang():
accept = Accept('Accept-Language', 'da, en-gb;q=0.8, en;q=0.7')
#FIXME: Accept._match_lang should be standalone function _match_lang
# that is attached as Accept._match during Accept.__init__.
assert accept._match('*', 'da')
assert accept._match('da', 'DA')
assert accept._match('en', 'en-gb')
assert accept._match('en-gb', 'en-gb')
assert not accept._match('en-gb', 'fr-fr')