コード例 #1
0
def test_generate_search_query():
    assert PIHandlerWeb.generate_search_query("SINUSOID") == {"q": "name:SINUSOID"}
    assert PIHandlerWeb.generate_search_query(r"BA:*.1", datasource="sourcename") == {
        "q": r"name:BA\:*.1",
        "scope": "pi:sourcename",
    }
    assert PIHandlerWeb.generate_search_query(tag="BA:*.1") == {
        "q": r"name:BA\:*.1",
    }
    assert PIHandlerWeb.generate_search_query(desc="Concentration Reactor 1") == {
        "q": r"description:Concentration\ Reactor\ 1",
    }
    assert PIHandlerWeb.generate_search_query(
        tag="BA:*.1", desc="Concentration Reactor 1"
    ) == {"q": r"name:BA\:*.1 AND description:Concentration\ Reactor\ 1"}
コード例 #2
0
def PIHandler():
    h = PIHandlerWeb(datasource=SOURCE, verifySSL=verifySSL)
    h.webidcache["alreadyknowntag"] = "knownwebid"
    yield h
コード例 #3
0
def test_escape_chars():
    assert (
        PIHandlerWeb.escape('+-&|(){}[]^"~*:\\') == r"\+\-\&\|\(\)\{\}\[\]\^\"\~*\:\\"
    )
コード例 #4
0
def PIHandler():
    h = PIHandlerWeb(datasource="sourcename")
    h.webidcache["alreadyknowntag"] = "knownwebid"
    yield h