示例#1
0
def test_add_status_module():
    @status.module("{dummy}")
    def dummy_method():
        return "dummy"

    assert status.evaluate("Dummy: {dummy}") == "Dummy: dummy"
    del status._modules["{dummy}"]  # Cleanup
示例#2
0
def test_log_unknown_module(mocker):
    mocker.patch.object(status, "_log_unknown_module")
    assert status.evaluate("Dummy: {unknown}") == "Dummy: "
    assert status._log_unknown_module.call_count == 1
示例#3
0
def test_evaluate_unknown_module():
    name = "{unknown-module}"
    assert status.evaluate(f"Dummy: {name}") == "Dummy: "
示例#4
0
def test_evaluate_status_module(dummy_module):
    name, content = dummy_module
    assert status.evaluate(f"Dummy: {name}") == f"Dummy: {content}"