Esempio n. 1
0
class WhenPopulatedWithTwoCalls:
    def setup(self):
        self.calls = CallList()
        for _ in range(2):
            self.calls.append(Call('name', (), {}, None))

    def should_not_have_one_element(self):
        assert not self.calls.one()
Esempio n. 2
0
class WhenEmpty:
    def setup(self):
        self.calls = CallList()

    def should_be_false_in_boolean_context(self):
        assert not self.calls

    def should_not_have_one_element(self):
        assert not self.calls.one()
Esempio n. 3
0
class WhenPopulatedWithACall:
    def setup(self):
        self.calls = CallList()
        self.calls.append(Call('test name',
                               'test args',
                               'test kwargs',
                               'test return_value'))

    def should_be_true_in_boolean_context(self):
        assert self.calls

    def should_have_exactly_one_call(self):
        assert self.calls.one()

    def should_not_return_call_when_querying_for_wrong_name(self):
        assert not self.calls('wrong name')

    def should_not_return_call_when_querying_for_wrong_args(self):
        assert not self.calls('test name', 'wrong args')

    def should_not_return_call_when_querying_for_wrong_kwargs(self):
        assert not self.calls('test name', wrong_key='wrong_value')