Ticket #18447: 18447_tests.patch

File 18447_tests.patch, 930 bytes (added by Roman Gladkov, 12 years ago)

test

  • tests/regressiontests/utils/simplelazyobject.py

    diff --git a/tests/regressiontests/utils/simplelazyobject.py b/tests/regressiontests/utils/simplelazyobject.py
    index 3f81e8f..0c15cae 100644
    a b from django.utils.functional import SimpleLazyObject, empty  
    1010
    1111
    1212class _ComplexObject(object):
     13
    1314    def __init__(self, name):
    1415        self.name = name
    1516
    class TestUtilsSimpleLazyObject(TestCase):  
    121122        self.assertEqual(unpickled, x)
    122123        self.assertEqual(six.text_type(unpickled), six.text_type(x))
    123124        self.assertEqual(unpickled.name, x.name)
     125
     126    def test_lazy_dict(self):
     127        lazydict = SimpleLazyObject(lambda: {'one': 1, 'two': 2,
     128                                             'three': 3, 'four': 4})
     129        self.assertTrue(lazydict['one'])
     130        lazydict['one'] = 0
     131        self.assertFalse(lazydict['one'])
Back to Top