Skip to content

Commit

Permalink
test: ad4630: Add test for ADAQ4224 scale attribute
Browse files Browse the repository at this point in the history
Add test for ADAQ4224 scale attribue.

Signed-off-by: Marcelo Schmitt <[email protected]>
  • Loading branch information
machschmitt committed Nov 8, 2023
1 parent 6489cce commit 65fd32a
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/test_ad4630.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import adi
import pytest

hardware = ["ad4030-24", "ad4630-24"]
Expand Down Expand Up @@ -55,3 +56,40 @@ def test_ad4630_channel_attrs(
test_attribute_single_value(
iio_uri, classname, attr, start, stop, step, tol, repeats, sub_channel
)


hardware = ["adaq4224"]
classname = "adi.adaq42xx"

#########################################
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize(
"attr, avail_attr, tol, repeats, sub_channel",
[("scale", "scale_available", 0, 1, "chan0",),],
)
def test_adaq42xx_scale_attr(
test_attribute_multiple_values,
iio_uri,
classname,
attr,
avail_attr,
tol,
repeats,
sub_channel,
):
# Get the device
sdr = eval(classname + "(uri='" + iio_uri + "')")

# Check hardware
if not hasattr(sdr, sub_channel):
raise AttributeError(sub_channel + " not defined in " + classname)
if not hasattr(getattr(sdr, sub_channel), avail_attr):
raise AttributeError(avail_attr + " not defined in " + classname)

# Get the list of available scale values
val = getattr(getattr(sdr, sub_channel), avail_attr)

test_attribute_multiple_values(
iio_uri, classname, attr, val, tol, repeats, sub_channel=sub_channel
)

0 comments on commit 65fd32a

Please sign in to comment.