frappy_demo.test: add simple writable

This commit is contained in:
2025-11-17 16:07:44 +01:00
parent f832e40898
commit 3575921ac0

View File

@@ -23,7 +23,7 @@
import random import random
from frappy.datatypes import FloatRange, StringType, ValueType, TupleOf, StructOf, ArrayOf, StatusType, BoolType from frappy.datatypes import FloatRange, StringType, ValueType, TupleOf, StructOf, ArrayOf, StatusType, BoolType
from frappy.modules import Communicator, Drivable, Parameter, Property, Readable, Module, Attached, Writable from frappy.modules import Communicator, Drivable, Parameter, Property, Readable, Module, Attached
from frappy.params import Command from frappy.params import Command
from frappy.dynamic import Pinata from frappy.dynamic import Pinata
from frappy.errors import RangeError, HardwareError from frappy.errors import RangeError, HardwareError
@@ -171,12 +171,3 @@ class Commands(Module):
"""array argument. raises an error when sum is negativ""" """array argument. raises an error when sum is negativ"""
if sum(a) < 0: if sum(a) < 0:
raise RangeError('sum must be >= 0') raise RangeError('sum must be >= 0')
class SimpleWritable(Writable):
def write_target(self, target):
self.value = target
if target < 0:
self.status = ERROR, 'negative'
else:
self.status = IDLE, ''