def should_trap_incorrect_args(self): ''' Specified foo(2) & bar(), and foo(1) called: UnmetSpecification''' mock_spec = MockSpec() collaborations = (mock_spec.foo(2), mock_spec.bar()) descriptions = [collaboration.description() for collaboration in collaborations] spec = Spec(CollaborateWith(*collaborations)) spec.describe_constraint().should_be(','.join(descriptions)) spec.verify(lambda: mock_spec.foo(1)).should_raise(UnmetSpecification)
def should_trap_incorrect_args(self): ''' Specified foo(2) & bar(), and foo(1) called: UnmetSpecification''' mock_spec = MockSpec() collaborations = (mock_spec.foo(2), mock_spec.bar()) descriptions = [ collaboration.description() for collaboration in collaborations ] spec = Spec(CollaborateWith(*collaborations)) spec.describe_constraint().should_be(','.join(descriptions)) spec.verify(lambda: mock_spec.foo(1)).should_raise(UnmetSpecification)
def should_trap_incorrect_call(self): ''' Specified foo() but bar() called: UnmetSpecification ''' mock_spec = MockSpec() spec = Spec(CollaborateWith(mock_spec.foo())) spec.describe_constraint().should_be(mock_spec.foo().description()) spec.verify(lambda: mock_spec.bar()).should_raise(UnmetSpecification)