add some tests, commands and bus class

added a couple of lower tests.

add some string tests to higher tests.

added bus class

add higher commands show, hide, shutdown, restart, version and type
This commit is contained in:
onyx-and-iris
2022-02-25 17:02:27 +00:00
parent 6e40ceb346
commit 364e456c94
6 changed files with 211 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
from .errors import VMCMDErrors
def strip_output_prop(param):
""" A channel prop. """
""" A strip output prop. """
def fget(self):
data = self.getter()
return not int.from_bytes(data.stripstate[self.index], 'little') & getattr(self._modes, f'_bus{param.lower()}') == 0
@@ -9,4 +9,15 @@ def strip_output_prop(param):
if not isinstance(val, bool) and val not in (0, 1):
raise VMCMDErrors(f'{param} is a boolean parameter')
self.setter(param, 1 if val else 0)
return property(fget, fset)
return property(fget, fset)
def bus_output_prop(param):
""" A bus output prop. """
def fget(self):
data = self.getter()
return not int.from_bytes(data.busstate[self.index], 'little') & getattr(self._modes, f'_bus{param.lower()}') == 0
def fset(self, val):
if not isinstance(val, bool) and val not in (0, 1):
raise VMCMDErrors(f'{param} is a boolean parameter')
self.setter(param, 1 if val else 0)
return property(fget, fset)