def single_author(request, author_id): author = get_object_or_404(Author, pk=author_id) return render_dictionary(author)
def test_none_object_renders_empty_dict(self): response = render_dictionary(None) self.assertContains(response, '<dict></dict>')
def test_dict_renders_as_dict(self): response = render_dictionary({'foo': 42}) self.assertContains(response, '<dict><key>foo</key><integer>42</integer></dict>')
def test_empty_dict_renders_empty_dict(self): response = render_dictionary({}) self.assertContains(response, '<dict></dict>')