コード例 #1
0
ファイル: test_zeroconf.py プロジェクト: ekos2001/aiohomekit
def test_non_existing_key_case_insensitive():
    props = {"C#": "259", "heLLo": "World"}
    val = get_from_properties(props, "c#")
    assert None is val
    val = get_from_properties(props, "c#", case_sensitive=True)
    assert None is val
    val = get_from_properties(props, "c#", case_sensitive=False)
    assert "259" == val

    val = get_from_properties(props, "HEllo", case_sensitive=False)
    assert "World" == val
コード例 #2
0
ファイル: test_zeroconf.py プロジェクト: ekos2001/aiohomekit
def test_non_existing_key_with_default_non_string():
    props = {"c#": "259"}
    val = get_from_properties(props, "s#", default=1)
    assert "1" == val
コード例 #3
0
ファイル: test_zeroconf.py プロジェクト: ekos2001/aiohomekit
def test_non_existing_key_no_default():
    props = {"c#": "259"}
    val = get_from_properties(props, "s#")
    assert val is None
コード例 #4
0
ファイル: test_zeroconf.py プロジェクト: ekos2001/aiohomekit
def test_existing_key():
    props = {"c#": "259"}
    val = get_from_properties(props, "c#")
    assert "259" == val