def __init__(self): Decorable.__init__(self) self.input_area = {} self.processing_area = {} self.output_area = {} self.log_area = {} self.tag = None self.location = None
def __init__(self, source, destination): Decorable.__init__(self) try: source |should| be_instance_of(Node) except: raise ContractError('Source: Node instance expected, instead %s passed' % type(source)) self.source = source try: destination |should| be_instance_of(Node) except: raise ContractError('Destination: Node instance expected, instead %s passed' % type(destination)) self.destination = destination
def __init__(self, source, destination): Decorable.__init__(self) try: source | should | be_instance_of(Node) except: raise ContractError( 'Source: Node instance expected, instead %s passed' % type(source)) self.source = source try: destination | should | be_instance_of(Node) except: raise ContractError( 'Destination: Node instance expected, instead %s passed' % type(destination)) self.destination = destination
class DecorableSpec(unittest.TestCase): def setUp(self): self.a_node = Decorable() self.a_decorator = Decorator() def it_gets_decorated(self): self.a_node.decorate(self.a_decorator) self.a_node |should| have(1).decorators self.a_node.decoration_history |should| have(1).element def it_gest_undecorated(self): self.a_node.decorate(self.a_decorator) self.a_node.undecorate(self.a_decorator) |should| be(True) self.a_node.undecorate('Something else') |should| be(False)
class DecorableSpec(unittest.TestCase): def setUp(self): self.a_node = Decorable() self.a_decorator = Decorator() def it_gets_decorated(self): self.a_node.decorate(self.a_decorator) self.a_node | should | have(1).decorators self.a_node.decoration_history | should | have(1).element def it_gest_undecorated(self): self.a_node.decorate(self.a_decorator) self.a_node.undecorate(self.a_decorator) | should | be(True) self.a_node.undecorate('Something else') | should | be(False)
def setUp(self): self.a_node = Decorable() self.a_decorator = Decorator()