Skip to content

Commit

Permalink
silence deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
jenshnielsen committed Jun 11, 2024
1 parent 044b263 commit fb8461c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions tests/test_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
)
from qcodes.metadatable import Metadatable
from qcodes.parameters import Function, Parameter
from qcodes.utils import QCoDeSDeprecationWarning

if TYPE_CHECKING:
from collections.abc import Iterator
Expand Down Expand Up @@ -273,12 +274,20 @@ def test_add_remove_f_p(testdummy) -> None:
testdummy.add_function('dac1', call_cmd='foo')

# test custom __get_attr__ for functions
fcn = testdummy['function']
assert isinstance(fcn, Function)
with pytest.warns(
QCoDeSDeprecationWarning,
match="Use attributes directly on the instrument object instead",
):
fcn = testdummy["function"]
assert isinstance(fcn, Function)
# by design, one gets the parameter if a function exists
# and has same name
dac1 = testdummy['dac1']
assert isinstance(dac1, Parameter)
with pytest.warns(
QCoDeSDeprecationWarning,
match="Use attributes directly on the instrument object instead",
):
dac1 = testdummy["dac1"]
assert isinstance(dac1, Parameter)


def test_instances(testdummy, parabola) -> None:
Expand Down

0 comments on commit fb8461c

Please sign in to comment.