Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(10)  |  Call(8)  |  Derive(0)  |  Import(2)

src/d/j/django-plist-0.6/django_plist/tests/shortcuttests.py   django-plist(Download)
 
from django.test import TestCase
 
from django_plist import render_array, render_dictionary
 
class RenderArrayTest(TestCase):
 
    def test_empty_iterable_renders_empty_array(self):
        response = render_array([])
    def test_none_object_renders_empty_array(self):
        response = render_array(None)
        self.assertContains(response, '<array></array>')
 
    def test_iterable_renders_objects_as_array(self):
        response = render_array([1,2,3])
    def test_as_plist_kwarg_is_invoked_on_iterable_objects(self):
        def to_int(binary):
            return int(binary, 2)
        response = render_array(['1', '10', '11'], as_plist=to_int)
        self.assertContains(response, '<array><integer>1</integer><integer>2</integer><integer>3</integer></array>')

src/d/j/django-plist-HEAD/django_plist/tests/shortcuttests.py   django-plist(Download)
 
from django.test import TestCase
 
from django_plist import render_array, render_dictionary
 
class RenderArrayTest(TestCase):
 
    def test_empty_iterable_renders_empty_array(self):
        response = render_array([])
    def test_none_object_renders_empty_array(self):
        response = render_array(None)
        self.assertContains(response, '<array></array>')
 
    def test_iterable_renders_objects_as_array(self):
        response = render_array([1,2,3])
    def test_as_plist_kwarg_is_invoked_on_iterable_objects(self):
        def to_int(binary):
            return int(binary, 2)
        response = render_array(['1', '10', '11'], as_plist=to_int)
        self.assertContains(response, '<array><integer>1</integer><integer>2</integer><integer>3</integer></array>')