2025-06-15 09:12:42 +00:00
|
|
|
#! /bin/env pytest
|
|
|
|
"""
|
|
|
|
Tests of the Python bindings for Hamlib
|
|
|
|
|
|
|
|
DO NOT EDIT this autogenerated file, run "make generate-pytests" instead
|
|
|
|
"""
|
|
|
|
import Hamlib
|
|
|
|
|
|
|
|
class TestClass:
|
|
|
|
"""A pytest class for Hamlib.Amp"""
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def setup_class(cls):
|
|
|
|
"""Common initialization before calling test methods"""
|
|
|
|
cls.actual_callables, cls.actual_properties = cls.generate_data(Hamlib.Amp)
|
|
|
|
|
|
|
|
def test_callables(self):
|
|
|
|
"""Check that nothing was added or removed"""
|
2025-06-15 10:28:40 +00:00
|
|
|
expected_callables = ['close', 'get_conf', 'get_freq', 'get_info', 'get_level', 'get_powerstat', 'open', 'reset', 'set_conf', 'set_freq', 'set_powerstat', 'token_lookup']
|
2025-06-15 09:12:42 +00:00
|
|
|
assert expected_callables == self.actual_callables
|
|
|
|
|
|
|
|
def test_properties(self):
|
|
|
|
"""Check that nothing was added or removed"""
|
|
|
|
expected_properties = ['caps', 'do_exception', 'error_status', 'state', 'thisown']
|
|
|
|
assert expected_properties == self.actual_properties
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def generate_data(cls, the_object):
|
|
|
|
"""Extract callables and properties from the given object"""
|
|
|
|
callables = []
|
|
|
|
properties = []
|
|
|
|
for method_or_property in dir(the_object):
|
|
|
|
if not method_or_property.startswith("_"):
|
|
|
|
if callable(getattr(the_object, method_or_property)):
|
|
|
|
callables.append(method_or_property)
|
|
|
|
else:
|
|
|
|
properties.append(method_or_property)
|
|
|
|
|
|
|
|
return callables, properties
|