mirror of
https://github.com/django/django.git
synced 2024-12-28 20:16:19 +00:00
23b32c7554
Thanks to abki for the report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16157 bcc190cf-cafb-0310-a4f2-bffc1f526a37
23 lines
616 B
Python
23 lines
616 B
Python
from django.utils import unittest
|
|
from django.utils.functional import lazy
|
|
|
|
|
|
class FunctionalTestCase(unittest.TestCase):
|
|
def test_lazy(self):
|
|
t = lazy(lambda: tuple(range(3)), list, tuple)
|
|
for a, b in zip(t(), range(3)):
|
|
self.assertEqual(a, b)
|
|
|
|
def test_lazy_base_class(self):
|
|
"""Test that lazy also finds base class methods in the proxy object"""
|
|
|
|
class Base(object):
|
|
def base_method(self):
|
|
pass
|
|
|
|
class Klazz(Base):
|
|
pass
|
|
|
|
t = lazy(lambda: Klazz(), Klazz)()
|
|
self.assertTrue('base_method' in dir(t))
|