当前位置: 首页>>代码示例>>Python>>正文


Python ErrorBundle.notice方法代码示例

本文整理汇总了Python中appvalidator.errorbundle.ErrorBundle.notice方法的典型用法代码示例。如果您正苦于以下问题:Python ErrorBundle.notice方法的具体用法?Python ErrorBundle.notice怎么用?Python ErrorBundle.notice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在appvalidator.errorbundle.ErrorBundle的用法示例。


在下文中一共展示了ErrorBundle.notice方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_notice

# 需要导入模块: from appvalidator.errorbundle import ErrorBundle [as 别名]
# 或者: from appvalidator.errorbundle.ErrorBundle import notice [as 别名]
def test_notice():
    """Test notice-related functions of the error bundler."""

    # Use the StringIO as an output buffer.
    bundle = ErrorBundle()

    bundle.notice((), "")

    # Load the JSON output as an object.
    output = json.loads(bundle.render_json())

    # Run some basic tests
    assert len(output["messages"]) == 1

    print output

    has_ = False

    for message in output["messages"]:
        print message

        if message["type"] == "notice":
            has_ = True

    assert has_
    assert not bundle.failed()
    assert not bundle.failed(True)
开发者ID:andrew361x,项目名称:perfalator,代码行数:29,代码来源:test_errorbundler.py

示例2: test_notice_friendly

# 需要导入模块: from appvalidator.errorbundle import ErrorBundle [as 别名]
# 或者: from appvalidator.errorbundle.ErrorBundle import notice [as 别名]
def test_notice_friendly():
    """
    Test notice-related human-friendly text output functions of the error
    bundler.
    """

    # Use the StringIO as an output buffer.
    bundle = ErrorBundle()

    bundle.notice((), "foobar")

    # Load the JSON output as an object.
    output = bundle.print_summary(verbose=True, no_color=True)
    print output

    assert output.count("foobar")
开发者ID:andrew361x,项目名称:perfalator,代码行数:18,代码来源:test_errorbundler.py

示例3: test_json

# 需要导入模块: from appvalidator.errorbundle import ErrorBundle [as 别名]
# 或者: from appvalidator.errorbundle.ErrorBundle import notice [as 别名]
def test_json():
    """Test the JSON output capability of the error bundler."""

    # Use the StringIO as an output buffer.
    bundle = ErrorBundle() # No color since no output
    bundle.set_tier(4)
    bundle.set_tier(3)

    bundle.error((), "error", "description")
    bundle.warning((), "warning", "description")
    bundle.notice((), "notice", "description")

    results = json.loads(bundle.render_json())

    eq_(len(results["messages"]), 3)
    assert not results["success"]
    eq_(results["ending_tier"], 4)
开发者ID:andrew361x,项目名称:perfalator,代码行数:19,代码来源:test_errorbundler.py

示例4: test_json_constructs

# 需要导入模块: from appvalidator.errorbundle import ErrorBundle [as 别名]
# 或者: from appvalidator.errorbundle.ErrorBundle import notice [as 别名]
def test_json_constructs():
    """This tests some of the internal JSON stuff so we don't break zamboni."""

    e = ErrorBundle()
    e.error(("a", "b", "c"), "Test")
    e.error(("a", "b", "foo"), "Test")
    e.error(("a", "foo", "c"), "Test")
    e.error(("a", "foo", "c"), "Test")
    e.error(("b", "foo", "bar"), "Test")
    e.warning((), "Context test",
              context=ContextGenerator("x\ny\nz\n"),
              line=2, column=0)
    e.notice((), "none")
    e.notice((), "line", line=1)
    e.notice((), "column", column=0)
    e.notice((), "line column", line=1, column=1)

    results = e.render_json()
    print results
    j = json.loads(results)

    assert "messages" in j
    for m in j["messages"]:
        if m["type"] == "warning":
            assert m["context"] == ["x", "y", "z"]

    for m in (m for m in j["messages"] if m["type"] == "notice"):
        if "line" in m["message"]:
            assert m["line"] is not None
            assert isinstance(m["line"], int)
            assert m["line"] > 0
        else:
            assert m["line"] is None

        if "column" in m["message"]:
            assert m["column"] is not None
            assert isinstance(m["column"], int)
            assert m["column"] > -1
        else:
            assert m["column"] is None
开发者ID:andrew361x,项目名称:perfalator,代码行数:42,代码来源:test_errorbundler.py


注:本文中的appvalidator.errorbundle.ErrorBundle.notice方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。