Hamlib/bindings/python/test_Hamlib_Amp_class.py

40 wiersze
1.5 KiB
Python
Czysty Zwykły widok Historia

#! /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"""
expected_callables = ['close', 'get_conf', 'get_freq', 'get_info', 'get_level', 'get_powerstat', 'open', 'reset', 'set_conf', 'set_freq', 'set_powerstat', 'token_lookup']
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