def test_no_tag(self): response = build_response(self.questions) data = response.split('\n\n') assert 3 == len(data) header, question1, question2 = data assert u'Stack Overflow: Top Questions' == header line1, line2, line3 = question1.split('\n') assert 'Is it possible to mix generator and a recursive function ?' == line1 assert 'http://stackoverflow.com/questions/3276956/pyhon-is-it-possible-to-mix-generator-and-a-recursive-function' == line2 assert 'Tags: python, recursive. (votes: 1, answers: 3, views: 20)' == line3 line1, line2, line3 = question2.split('\n') assert 'Set Django ModelForm visible fields at runtime?' == line1 assert 'http://stackoverflow.com/questions/3276896/set-django-modelform-visible-fields-at-runtime' == line2 assert 'Tags: python, django. (votes: 4, answers: 2, views: 10)' == line3
def test_tagged(self): response = build_response(self.questions, tag='recursive') data = response.split('\n\n') assert 2 == len(data) assert u'Stack Overflow: recursive tag' == data[0]