Beispiel #1
0
def given_when_then_behaviour(): 
    ''' given empty list when item appended then list length should be one '''
    spec = Spec([])
    spec.when(spec.append(object())).then(spec.it()).should_be(Length(1))

    def empty_list():
        ''' descriptive name for fn returning an empty list '''
        return []
    spec = Spec(type([]), given=empty_list)
    spec.when(spec.append('monty')).then(spec.it()).should_be(Length(1))
def given_when_then_behaviour():
    ''' given empty list when item appended then list length should be one '''
    spec = Spec([])
    spec.when(spec.append(object())).then(spec.it()).should_be(Length(1))

    def empty_list():
        ''' descriptive name for fn returning an empty list '''
        return []

    spec = Spec(type([]), given=empty_list)
    spec.when(spec.append('monty')).then(spec.it()).should_be(Length(1))
Beispiel #3
0
def should_contain_behaviour():
    ''' should_ and should_not_ contain methods delegate to Contain '''
    spec = Spec(['brave', 'brave', 'sir robin'])
    spec.it().should_contain('brave')
    spec.it().should_not_contain('bravely ran away')
def should_contain_behaviour():
    ''' should_ and should_not_ contain methods delegate to Contain '''
    spec = Spec(['brave', 'brave', 'sir robin'])
    spec.it().should_contain('brave')
    spec.it().should_not_contain('bravely ran away')