本文整理汇总了Python中validator.decorator.version_range函数的典型用法代码示例。如果您正苦于以下问题:Python version_range函数的具体用法?Python version_range怎么用?Python version_range使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了version_range函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_fx13_interfaces
def test_fx13_interfaces():
"""
Test that the Gecko 13 compatibility warnings and errors for matched
patterns are thrown when they're supposed to.
"""
err = _do_real_test_raw("""
var x = Components.interfaces.nsILivemarkService;
""", versions={FIREFOX_GUID: version_range("firefox", "13.0a1")})
assert not err.failed(fail_on_warnings=False)
assert err.compat_summary["errors"]
err = _do_real_test_raw("""
var x = Components.interfaces.nsIPrefBranch2;
""", versions={FIREFOX_GUID: version_range("firefox", "13.0a1")})
assert not err.failed(fail_on_warnings=False)
assert err.compat_summary["warnings"]
err = _do_real_test_raw("""
var x = Components.interfaces.nsIScriptableUnescapeHTML;
""", versions={FIREFOX_GUID: version_range("firefox", "13.0a1")})
assert not err.failed(fail_on_warnings=False)
assert err.compat_summary["warnings"]
err = _do_real_test_raw("""
var x = Components.interfaces.nsIAccessNode;
""", versions={FIREFOX_GUID: version_range("firefox", "13.0a1")})
assert not err.failed(fail_on_warnings=False)
assert err.compat_summary["errors"]
开发者ID:wraithan,项目名称:amo-validator,代码行数:29,代码来源:test_compatibility.py
示例2: test_fx7_nsIDOMFile
def test_fx7_nsIDOMFile():
"""Test that nsIDOMFile methods are flagged."""
err = _do_real_test_raw("""
var x = Components.classes.createInstance(
Components.interfaces.nsIDOMFile);
x.getAsBinary();
""")
assert not err.failed()
assert not err.notices
assert not any(err.compat_summary.values())
err = _do_real_test_raw("""
var x = Components.classes["foo"].createInstance(
Components.interfaces.nsIDOMFile);
x.getAsDataURL();
""", versions={'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}':
version_range("firefox", "7.0a1")})
assert not err.failed()
assert len(err.notices) == 1
assert err.compat_summary["errors"]
err = _do_real_test_raw("""
var x = document.getElementById("whatever");
x.getAsDataURL();
""", versions={'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}':
version_range("firefox", "7.0a1")})
assert not err.failed()
assert len(err.notices) == 1
assert err.compat_summary["errors"]
开发者ID:malyshkosergey,项目名称:amo-validator,代码行数:30,代码来源:test_compatibility.py
示例3: test_window_top
def test_window_top():
"""
Test that 'window.top' (a reserved global variable as of Firefox 6) is
flagged as incompatible.
"""
err = _do_real_test_raw("""
window.top = "foo";
top = "bar";
""")
print err.print_summary(verbose=True)
assert not err.failed()
assert not err.notices
err = _do_real_test_raw("""
window.top = "foo";
""", versions={'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}':
version_range("firefox", "6.0a1")})
print err.print_summary(verbose=True)
assert not err.failed()
assert err.notices
assert err.compat_summary["warnings"]
err = _do_real_test_raw("""
top = "foo";
""", versions={'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}':
version_range("firefox", "6.0a1")})
print err.print_summary(verbose=True)
assert not err.failed()
assert err.notices
assert err.compat_summary["warnings"]
开发者ID:malyshkosergey,项目名称:amo-validator,代码行数:31,代码来源:test_compatibility.py
示例4: test_fx7_nsIDOMFile
def test_fx7_nsIDOMFile():
"""Test that nsIDOMFile methods are flagged."""
err = _do_real_test_raw("""
var x = Components.classes.createInstance(
Components.interfaces.nsIDOMFile);
x.getAsBinary();
""")
assert not err.failed(fail_on_warnings=False)
assert not err.notices
assert not any(err.compat_summary.values())
err = _do_real_test_raw("""
var x = Components.classes["foo"].createInstance(
Components.interfaces.nsIDOMFile);
x.getAsDataURL();
""", versions={FIREFOX_GUID: version_range("firefox", "7.0a1")})
assert not err.failed(fail_on_warnings=False)
assert len(err.notices) == 1
assert err.compat_summary["errors"]
err = _do_real_test_raw("""
var x = document.getElementById("whatever");
x.getAsDataURL();
""", versions={FIREFOX_GUID: version_range("firefox", "7.0a1")})
assert not err.failed()
assert len(err.notices) == 1
assert err.compat_summary["errors"]
开发者ID:wraithan,项目名称:amo-validator,代码行数:28,代码来源:test_compatibility.py
示例5: amp_rp_bug660359
def amp_rp_bug660359(wrapper, arguments, traverser):
"""
Flag all calls to AddonManagerPrivate.registerProvider for incompatibility
with Firefox 6.
"""
traverser.err.notice(
err_id=("testcases_javascript_calldefinitions",
"amp_rp_bug660359"),
notice="Custom add-on types may not work properly in Firefox 6",
description="This add-on appears to register custom add-on types, "
"which are affected and may not work properly due to "
"changes made on Firefox 6. For more information, "
"please refer to "
"https://bugzilla.mozilla.org/show_bug.cgi?id=595848",
filename=traverser.filename,
line=traverser.line,
column=traverser.position,
context=traverser.context,
for_appversions={'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}':
version_range("firefox", "6.0a1", "7.0a1"),
'{3550f703-e582-4d05-9a08-453d09bdfdc6}':
version_range("thunderbird", "6.0a1", "7.0a1"),},
compatibility_type="error",
tier=5)
开发者ID:washort,项目名称:amo-validator,代码行数:25,代码来源:call_definitions.py
示例6: document_getSelection
def document_getSelection(wrapper, arguments, traverser):
"""Flag Firefox 8 calls to document.getSelection()."""
MDN_ARTICLE = "https://developer.mozilla.org/En/Window.getSelection"
traverser.err.notice(
err_id=("testcases_javascript_calldefinitions", "document_getSel"),
notice="document.getSelection()'s return type has changed.",
description="The return type of document.getSelection() has changed "
"in Firefox 8. This function is deprecated, and you "
"should be using window.getSelection() instead. See "
"%s for more information." % MDN_ARTICLE,
filename=traverser.filename,
line=traverser.line,
column=traverser.position,
context=traverser.context,
compatibility_type="error",
for_appversions={'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}':
version_range("firefox", "8.0a1", "9.0a1"),
'{3550f703-e582-4d05-9a08-453d09bdfdc6}':
version_range("thunderbird", "8.0a1", "9.0a1"),},
tier=5)
# The new spec returns an object.
return JSWrapper(JSObject(), traverser=traverser)
开发者ID:washort,项目名称:amo-validator,代码行数:25,代码来源:call_definitions.py
示例7: test_tb7_deRDF_addressbook
def test_tb7_deRDF_addressbook():
"""Test that addressbook rdf sources are flagged"""
err = _do_real_test_raw("""
var x = 'datasources="rdf:addressdirectory" ref="moz-abdirectory://"';
""")
assert not err.failed()
assert not err.notices
err = _do_real_test_raw("""
var x = 'datasources="rdf:addressdirectory" ref="moz-abdirectory://"';
""", versions={TB_GUID: version_range("thunderbird", "7.0a1")})
assert not err.failed()
assert err.notices
assert err.compat_summary["errors"]
err = _do_real_test_raw("""
var x = 'GetResource(SomeText).QueryInterface(6inTestxnsIAbDirectory);';
""")
assert not err.failed()
assert not err.notices
err = _do_real_test_raw("""
var x = "GetResource(SomeText).QueryInterface(Some8678StuffnsIAbDirectory)";
""", versions={TB_GUID: version_range("thunderbird", "7.0a1")})
assert not err.failed()
assert err.notices
assert err.compat_summary["errors"]
开发者ID:wraithan,项目名称:amo-validator,代码行数:28,代码来源:test_compatibility.py
示例8: test_version_range_before
def test_version_range_before():
"""Test the `before` parameter of version_range."""
new_versions = {"1": {"guid": "foo",
"versions": map(str, range(10))}}
eq_(version_range("foo", "5", "6", app_versions=new_versions), ["5"])
eq_(version_range("foo", "8", "50", app_versions=new_versions), ["8", "9"])
开发者ID:malyshkosergey,项目名称:amo-validator,代码行数:8,代码来源:test_compatibility.py
示例9: test_version_range_before
def test_version_range_before():
"""Test the `before` parameter of version_range."""
new_versions = {'1': {'guid': 'foo',
'versions': map(str, range(10))}}
assert decorator.version_range('foo', '5', '6', app_versions=new_versions) == ['5']
assert decorator.version_range('foo', '8', '50', app_versions=new_versions) == ['8', '9']
开发者ID:AutomatedTester,项目名称:amo-validator,代码行数:8,代码来源:test_decorator.py
示例10: test_version_range
def test_version_range():
"""
Tests that the appropriate versions after the specified versions are
returned.
"""
new_versions = {'1': {'guid': 'foo',
'versions': map(str, range(10))}}
assert decorator.version_range('foo', '8', app_versions=new_versions) == ['8', '9']
assert decorator.version_range('foo', '5', app_versions=new_versions) == ['5', '6', '7', '8', '9']
开发者ID:AutomatedTester,项目名称:amo-validator,代码行数:10,代码来源:test_decorator.py
示例11: test_version_range
def test_version_range():
"""
Tests that the appropriate versions after the specified versions are
returned.
"""
new_versions = {"1": {"guid": "foo",
"versions": map(str, range(10))}}
eq_(version_range("foo", "8", app_versions=new_versions), ["8", "9"])
eq_(version_range("foo", "5", app_versions=new_versions),
["5", "6", "7", "8", "9"])
开发者ID:malyshkosergey,项目名称:amo-validator,代码行数:11,代码来源:test_compatibility.py
示例12: test_requestAnimationFrame
def test_requestAnimationFrame():
"""
Test that requestAnimationFrame requires at least one parameter.
"""
err = _do_real_test_raw("""
requestAnimationFrame(foo);
""", versions={FIREFOX_GUID: version_range("firefox", "11.0a1")})
assert not err.failed()
err = _do_real_test_raw("""
requestAnimationFrame();
""", versions={FIREFOX_GUID: version_range("firefox", "11.0a1")})
assert err.failed()
assert err.compat_summary["errors"]
开发者ID:wraithan,项目名称:amo-validator,代码行数:15,代码来源:test_compatibility.py
示例13: test_fx9_nsIBrowserHistory_removePages
def test_fx9_nsIBrowserHistory_removePages():
"""
nsIBrowserHistory.removePages() takes 2 arguments instead of 3 in
Firefox 9.
"""
futureCompatError(
"""
var browserHistory = Components.classes[
"@mozilla.org/browser/global-history;2"]
.getService(
Components.interfaces.nsIBrowserHistory);
browserHistory.removePages(uriList, uriList.length, false);
""",
'9.0a1')
err = _do_real_test_raw(
"""
var browserHistory = Components.classes[
"@mozilla.org/browser/global-history;2"]
.getService(
Components.interfaces.nsIBrowserHistory);
browserHistory.removePages(uriList, uriList.length);
""",
versions={FIREFOX_GUID: version_range("firefox", "9.0a1")})
assert not err.failed(fail_on_warnings=False)
assert not err.compat_summary["errors"]
开发者ID:wraithan,项目名称:amo-validator,代码行数:26,代码来源:test_compatibility.py
示例14: test_tb12_compatibility
def test_tb12_compatibility():
"""
Test that the changed/removed interfaces for Thunderbird 12 are flagged.
"""
err = _do_real_test_raw("""
var x = Components.classes["foo"].createInstance(
Components.interfaces.nsIMsgDBService);
x.openMailDBFromFile();
var y = Components.classes["foo"].createInstance(
Components.interfaces.nsIMsgDatabase);
y.Open();
""")
assert not err.failed(fail_on_warnings=False)
assert not err.warnings
assert not any(err.compat_summary.values())
err = _do_real_test_raw("""
var x = Components.classes["foo"].createInstance(
Components.interfaces.nsIMsgDBService);
x.openMailDBFromFile();
var y = Components.classes["foo"].createInstance(
Components.interfaces.nsIMsgDatabase);
y.Open();
""", versions={TB_GUID: version_range("thunderbird", "12.0a1")})
assert err.failed
assert len(err.notices) == 2
assert err.compat_summary["errors"]
开发者ID:wraithan,项目名称:amo-validator,代码行数:28,代码来源:test_compatibility.py
示例15: test_fx9_nsIURLParser_parsePath
def test_fx9_nsIURLParser_parsePath():
"""
nsIURLParser.parsePath takes 8 args instead of 10 now.
"""
futureCompatError(
"""
var URLi = Components.classes[
"@mozilla.org/network/url-parser;1?auth=maybe"].
createInstance(Components.interfaces.nsIURLParser);
var filepathPos = {}, filepathLen = {}, paramPos = {}, paramLen = {},
queryPos = {}, queryLen = {}, refPos = {}, refLen = {};
URLi.parsePath(urlObj.path, -1, filepathPos, filepathLen, paramPos,
paramLen, queryPos, queryLen, refPos, refLen);
""",
'9.0a1')
err = _do_real_test_raw(
"""
var URLi = Components.classes[
"@mozilla.org/network/url-parser;1?auth=maybe"].
createInstance(Components.interfaces.nsIURLParser);
var filepathPos = {}, filepathLen = {}, queryPos = {}, queryLen = {},
refPos = {}, refLen = {};
URLi.parsePath(urlObj.path, -1, filepathPos, filepathLen, queryPos,
queryLen, refPos, refLen);
""",
versions={FIREFOX_GUID: version_range("firefox", "9.0a1")})
assert not err.failed(fail_on_warnings=False)
assert not err.compat_summary["errors"]
开发者ID:wraithan,项目名称:amo-validator,代码行数:29,代码来源:test_compatibility.py
示例16: test_tb10_compatibility
def test_tb10_compatibility():
"""
Test that MsgDeleteMessageFromMessageWindow, goToggleSplitter,
AddMessageComposeOfflineObserver, and RemoveMessageComposeOfflineObserver
are flagged.
"""
err = _do_real_test_raw("""
var x = "";
x = MsgDeleteMessageFromMessageWindow();
goToggleSplitter();
AddMessageComposeOfflineObserver();
RemoveMessageComposeOfflineObserver();
x = gDownloadManagerStrings.get();
""")
assert not err.failed(fail_on_warnings=False)
assert not err.warnings
assert not any(err.compat_summary.values())
err = _do_real_test_raw("""
var x = "";
x = MsgDeleteMessageFromMessageWindow();
goToggleSplitter();
AddMessageComposeOfflineObserver();
RemoveMessageComposeOfflineObserver();
x = gDownloadManagerStrings.get();
""", versions={TB_GUID: version_range("thunderbird", "10.0a1")})
assert err.failed()
assert len(err.warnings) == 1
assert len(err.notices) == 4
assert err.compat_summary["errors"]
开发者ID:wraithan,项目名称:amo-validator,代码行数:31,代码来源:test_compatibility.py
示例17: test_tb9_compatibility
def test_tb9_compatibility():
"""
Test that gComposeBundle, FocusOnFirstAttachment, WhichPaneHasFocus are
flagged.
"""
err = _do_real_test_raw("""
var x = "";
x = gComposeBundle();
FocusOnFirstAttachment();
WhichPaneHasFocus();
""")
assert not err.failed(fail_on_warnings=False)
assert not err.notices
assert not any(err.compat_summary.values())
err = _do_real_test_raw("""
var x = "";
x = gComposeBundle();
FocusOnFirstAttachment();
WhichPaneHasFocus();
""", versions={TB_GUID: version_range("thunderbird", "9.0a1")})
assert not err.failed(fail_on_warnings=False)
assert len(err.notices) == 3
assert err.compat_summary["errors"]
开发者ID:wraithan,项目名称:amo-validator,代码行数:25,代码来源:test_compatibility.py
示例18: test_tb7_mail_attachment_api
def test_tb7_mail_attachment_api():
"""Test that the old mail attachment global functions are flagged."""
err = _do_real_test_raw("""
createNewAttachmentInfo();
saveAttachment();
attachmentIsEmpty();
openAttachment();
detachAttachment();
cloneAttachment();
""")
assert not err.failed()
assert not err.notices
assert not any(err.compat_summary.values())
err = _do_real_test_raw("""
createNewAttachmentInfo();
saveAttachment();
attachmentIsEmpty();
openAttachment();
detachAttachment();
cloneAttachment();
""", versions={TB_GUID: version_range("thunderbird", "7.0a1")})
assert not err.failed()
assert len(err.notices) == 6
assert err.compat_summary["errors"]
开发者ID:wraithan,项目名称:amo-validator,代码行数:26,代码来源:test_compatibility.py
示例19: test_fx9_nsIEditor_updateDefaultDictionary
def test_fx9_nsIEditor_updateDefaultDictionary():
"""
nsIEditorSpellCheck.UpdateDefaultDictionary takes no arguments in
Firefox 9.
"""
futureCompatError(
"""
var spellChecker = Components.classes[
'@mozilla.org/editor/editorspellchecker;1']
.createInstance(
Components.interfaces.nsIEditorSpellCheck);
spellChecker.UpdateCurrentDictionary(null);
""",
'9.0a1')
err = _do_real_test_raw(
"""
var spellChecker = Components.classes[
'@mozilla.org/editor/editorspellchecker;1']
.createInstance(
Components.interfaces.nsIEditorSpellCheck);
spellChecker.UpdateCurrentDictionary();
""",
versions={FIREFOX_GUID: version_range("firefox", "9.0a1")})
assert not err.failed(fail_on_warnings=False)
assert not err.compat_summary["errors"]
开发者ID:wraithan,项目名称:amo-validator,代码行数:26,代码来源:test_compatibility.py
示例20: test_tb11_compatibility
def test_tb11_compatibility():
"""
Test that the changed/removed interfaces for Thunderbird 11 are flagged.
"""
err = _do_real_test_raw("""
var x = Components.classes["foo"].createInstance(
Components.interfaces.nsIMsgQuote);
x.quoteMessage();
var y = Components.classes["foo"].createInstance(
Components.interfaces.nsIMailtoUrl);
y.GetMessageContents();
""")
assert not err.failed(fail_on_warnings=False)
assert not err.warnings
assert not any(err.compat_summary.values())
err = _do_real_test_raw("""
var x = Components.classes["foo"].createInstance(
Components.interfaces.nsIMsgQuote);
x.quoteMessage();
var y = Components.classes["foo"].createInstance(
Components.interfaces.nsIMailtoUrl);
y.GetMessageContents();
""", versions={TB_GUID: version_range("thunderbird", "11.0a1")})
assert err.failed
assert len(err.notices) == 2
assert err.compat_summary["errors"]
开发者ID:wraithan,项目名称:amo-validator,代码行数:28,代码来源:test_compatibility.py
注:本文中的validator.decorator.version_range函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论