Exemplo n.º 1
0
def test_reads(plc, tag_name, data_type, value):
    result = plc.read(tag_name)
    assert result
    assert result.error is None
    assert result.tag == tag_only(tag_name)
    assert result.type == data_type
    assert result.value == value
Exemplo n.º 2
0
def test_bool_array_writes(plc, tag_name, data_type, value):
    result = plc.write((tag_name, value))
    assert result
    assert result.error is None
    assert result.tag == tag_only(tag_name)
    assert result.type == data_type

    assert result == plc.read(tag_name)  # read the same tag and make sure it matches
Exemplo n.º 3
0
def test_multi_write(plc):
    """
    Read all the test tags in a single read() call instead of individually
    """
    tags = [(tag, value) for (tag, _, value) in all_write_tests]
    results = plc.write(*tags)
    assert len(results) == len(all_write_tests)

    for result, (tag, typ, value) in zip(results, all_write_tests):
        assert result
        assert result.error is None
        assert result.tag == tag_only(tag)
        assert result.type == typ
        assert result.value == value