diff --git a/bindings/amplifier.swg b/bindings/amplifier.swg index 26d4c4c8d..4a94ed736 100644 --- a/bindings/amplifier.swg +++ b/bindings/amplifier.swg @@ -144,6 +144,7 @@ typedef struct Amp { return s; } + AMPMETHOD1GET(get_powerstat, powerstat_t) }; %{ @@ -151,8 +152,4 @@ typedef struct Amp { { self->error_status = amp_get_freq(self->amp, freq); } - void Amp_get_powerstat(Amp *self, powerstat_t *status) - { - self->error_status = amp_get_powerstat(self->amp, status); - } %} diff --git a/bindings/python/test_amp.py b/bindings/python/test_amp.py index 0673d644c..f3239d3a3 100755 --- a/bindings/python/test_amp.py +++ b/bindings/python/test_amp.py @@ -64,6 +64,36 @@ class TestClass: assert amp.set_powerstat(Hamlib.RIG_POWER_ON) is None assert amp.get_powerstat() == Hamlib.RIG_POWER_ON assert amp.close() is None + + + def test_all_methods(self): + """Just call all the methods""" + amp = Hamlib.Amp(AMP_MODEL) + assert amp is not None + + # the tests that do not depend on open() + assert amp.set_conf("", "") is None + assert amp.get_conf("") == "" + assert amp.get_conf(0) == "" + conf = amp.get_conf("mcfg") + assert isinstance(conf, str) + assert amp.set_conf("mcfg", "foo") is None + conf = amp.get_conf("mcfg") + assert conf == "" # FIXME: should return "foo" + assert amp.token_lookup("") is None + + # the tests that depend on open() + assert amp.state.comm_state == 0 + assert amp.open() is None + assert amp.state.comm_state == 1 + info = amp.get_info() + assert isinstance(info, str) + assert amp.reset(Hamlib.AMP_RESET_FAULT) is None + assert amp.set_freq(0) is None + # assert amp.get_freq() is None # FIXME: AttributeError: 'Amp' object has no attribute 'get_freq' + assert amp.set_powerstat(Hamlib.RIG_POWER_ON) is None + assert amp.get_powerstat() == Hamlib.RIG_POWER_ON + assert amp.close() is None assert amp.state.comm_state == 0 info = amp.get_info() assert info is None