Esempio n. 1
0
def test_property_RW():
    assert properties.device.priorities() == "MULTI_DEVICE_PRIORITIES"
    assert properties.device.priorities("CPU,GPU") == ("MULTI_DEVICE_PRIORITIES", OVAny("CPU,GPU,"))
    assert properties.device.priorities("CPU", "GPU") == ("MULTI_DEVICE_PRIORITIES", OVAny("CPU,GPU,"))

    with pytest.raises(TypeError) as e:
        val = 6
        properties.device.priorities("CPU", val)
    assert f"Incorrect passed value: {val} , expected string values." in str(e.value)
Esempio n. 2
0
def test_any_class():
    class TestClass:
        def __init__(self):
            self.text = "test"

    v = OVAny(TestClass())
    assert isinstance(v.value, TestClass)
    assert v.value.text == "test"
Esempio n. 3
0
def test_any_set_new_value():
    v = OVAny(int(1))
    assert isinstance(v.value, int)
    v = OVAny("test")
    assert isinstance(v.value, str)
    assert v == "test"
Esempio n. 4
0
def test_any_int_dict():
    v = OVAny({1: 2})
    assert isinstance(v.value, dict)
    assert v[1] == 2
Esempio n. 5
0
def test_any_str():
    var = OVAny("test_string")
    assert isinstance(var.value, str)
    assert var == "test_string"
Esempio n. 6
0
def test_any_dict_str_int():
    v = OVAny({"key": 2})
    assert isinstance(v.value, dict)
    assert v["key"] == 2
Esempio n. 7
0
def test_any_dict_str():
    v = OVAny({"key": "value"})
    assert isinstance(v.value, dict)
    assert v["key"] == "value"
Esempio n. 8
0
def test_any_bool():
    v = OVAny(False)
    assert isinstance(v.value, bool)
    assert v is not True
Esempio n. 9
0
def test_any_float_list():
    v = OVAny([21.0, 37.0])
    assert isinstance(v.value, list)
    assert len(v) == 2
    assert isinstance(v[0], float)
Esempio n. 10
0
def test_any_int_list():
    v = OVAny([21, 37])
    assert isinstance(v.value, list)
    assert len(v) == 2
    assert isinstance(v[0], int)
Esempio n. 11
0
def test_any_string_list():
    var = OVAny(["test", "string"])
    assert isinstance(var.value, list)
    assert isinstance(var[0], str)
    assert var[0] == "test"
Esempio n. 12
0
def test_any_float():
    var = OVAny(21.37)
    assert isinstance(var.value, float)
Esempio n. 13
0
def test_any_int():
    var = OVAny(2137)
    assert isinstance(var.value, int)
    assert var == 2137
Esempio n. 14
0
def test_any():
    any_int = OVAny(32)
    any_str = OVAny("test_text")

    assert any_int.get() == 32
    assert any_str.get() == "test_text"

    any_int.set(777)
    any_str.set("another_text")

    assert any_int.get() == 777
    assert any_str.get() == "another_text"
Esempio n. 15
0
def test_any_tuple():
    v = OVAny((2, 1))
    assert isinstance(v.value, tuple)