Attribute Tests

Functions used by test fixtures for evaluating attributes and driver state.

test.attr_tests.attribute_multipe_values(uri, classname, attr, values, tol, repeats=1, sleep=0)

attribute_multipe_values: Write and read back multiple class properties in a loop where all values are pre-defined. This is performed a defined number of times.

parameters:
uri: type=string

URI of IIO context of target board/system

classname: type=string

Name of pyadi interface class which contain attribute

attr: type=string

Attribute name to be written. Must be property of classname

values: type=list

A list of values to write and check as attributes

tol: type=integer

Allowable error of written value compared to read back value

repeats: type=integer

Number of times to repeatedly write values

test.attr_tests.attribute_multipe_values_with_depends(uri, classname, attr, depends, values, tol, repeats=1)

attribute_multipe_values_with_depends: Write and read back multiple class properties in a loop where all values are pre-defined, where a set of dependent attributes are written first. This is performed a defined number of times.

parameters:
uri: type=string

URI of IIO context of target board/system

classname: type=string

Name of pyadi interface class which contain attribute

attr: type=string

Attribute name to be written. Must be property of classname

depends: type=list

A list of dependent values to write and check as attributes

values: type=list

A list of values to write and check as attributes

tol: type=integer

Allowable error of written value compared to read back value

repeats: type=integer

Number of times to repeatedly write values

test.attr_tests.attribute_single_value(uri, classname, attr, start, stop, step, tol, repeats=1, sub_channel=None)

attribute_single_value: Write and read back integer class property This is performed a defined number of times and the value written is randomly determined based in input parameters

parameters:
uri: type=string

URI of IIO context of target board/system

classname: type=string

Name of pyadi interface class which contain attribute

attr: type=string

Attribute name to be written. Must be property of classname

start: type=integer

Lower bound of possible values attribute can be

stop: type=integer

Upper bound of possible values attribute can be

step: type=integer

Difference between successive values attribute can be

tol: type=integer

Allowable error of written value compared to read back value

repeats: type=integer

Number of random values to tests. Generated from uniform distribution

sub_channel: type=string

Name of sub channel (nested class) to be tested

test.attr_tests.attribute_single_value_boolean(uri, classname, attr, value)

attribute_single_value_boolean: Write and read back boolean class property

parameters:
uri: type=string

URI of IIO context of target board/system

classname: type=string

Name of pyadi interface class which contain attribute

attr: type=string

Attribute name to be written. Must be property of classname

val: type=string

Value to write and read back from attribute

test.attr_tests.attribute_single_value_pow2(uri, classname, attr, max_pow, tol, repeats=1)

attribute_single_value_pow2: Write and read back integer class property where the integer is a power of 2. This is performed a defined number of times and the value written is randomly determined based in input parameters

parameters:
uri: type=string

URI of IIO context of target board/system

classname: type=string

Name of pyadi interface class which contain attribute

attr: type=string

Attribute name to be written. Must be property of classname

max_pow: type=integer

Largest power of 2 attribute allow to be

tol: type=integer

Allowable error of written value compared to read back value

repeats: type=integer

Number of random values to tests. Generated from uniform distribution

test.attr_tests.attribute_single_value_readonly(uri, classname, attr, lower, upper, repeats=1, sub_channel=None)

attribute_single_value: Write and read back integer class property This is performed a defined number of times and the value written is randomly determined based in input parameters

parameters:
uri: type=string

URI of IIO context of target board/system

classname: type=string

Name of pyadi interface class which contain attribute

attr: type=string

Attribute name to be written. Must be property of classname

lower: type=integer or float

Lower bound of possible values attribute can be

upper: type=integer or float

Upper bound of possible values attribute can be

repeats: type=integer

Number of random values to tests. Generated from uniform distribution

sub_channel: type=string

Name of sub channel (nested class) to be tested

test.attr_tests.attribute_single_value_str(uri, classname, attr, val, tol)

attribute_single_value_str: Write and read back string class property

parameters:
uri: type=string

URI of IIO context of target board/system

classname: type=string

Name of pyadi interface class which contain attribute

attr: type=string

Attribute name to be written. Must be property of classname

val: type=string

Value to write and read back from attribute

tol: type=integer

Allowable error of written value compared to read back value

test.attr_tests.attribute_write_only_str(uri, classname, attr, value)

attribute_write_only_str: Write only string class property

parameters:
uri: type=string

URI of IIO context of target board/system

classname: type=string

Name of pyadi interface class which contain attribute

attr: type=string

Attribute name to be written. Must be property of classname

value: type=string

Value to write into attr property

test.attr_tests.attribute_write_only_str_with_depends(uri, classname, attr, value, depends)

attribute_write_only_str_with_depends: Write only string class property with dependent write only properties

parameters:
uri: type=string

URI of IIO context of target board/system

classname: type=string

Name of pyadi interface class which contain attribute

attr: type=string

Attribute name to be written. Must be property of classname

value: type=string

Value to write into attr property

depends: type=dict

Dictionary of properties to write before value is written. Keys are properties and values are values to be written

test.attr_tests.floor_step_size(quantity, step_size)

Quantize to specific stepsize

parameters:
quanity: type=float

Value to be quantized

step_size: type=str

Step size to quantize quanity to