Django

Code

Changeset 7750

Show
Ignore:
Timestamp:
06/25/08 23:22:12 (5 months ago)
Author:
adrian
Message:

Negligible formatting changes to tests/regressiontests/templates/loaders.py

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/regressiontests/templates/loaders.py

    r7567 r7750  
    1 # -*- coding: utf-8 -*- 
    21""" 
    32Test cases for the template loaders 
     3 
     4Note: This test requires setuptools! 
    45""" 
    56 
     
    1819from django.template.loaders.eggs import load_template_source as lts_egg 
    1920 
    20 #Mock classes and objects for pkg_resources functions 
     21# Mock classes and objects for pkg_resources functions. 
    2122class MockProvider(pkg_resources.NullProvider): 
    2223    def __init__(self, module): 
     
    3637        return self.module._resources[path].read() 
    3738 
    38 class MockLoader(object): pass 
     39class MockLoader(object): 
     40    pass 
    3941 
    4042def create_egg(name, resources): 
    4143    """ 
    42     Creates a mock egg with a list of resources 
    43      
    44     name: The name of the module 
    45     resources: A dictionary of resources. Keys are the names and values the the data.  
     44    Creates a mock egg with a list of resources. 
     45 
     46    name: The name of the module. 
     47    resources: A dictionary of resources. Keys are the names and values the the data. 
    4648    """ 
    4749    egg = imp.new_module(name) 
     
    5052    sys.modules[name] = egg 
    5153 
    52  
    5354class EggLoader(unittest.TestCase): 
    5455    def setUp(self): 
    5556        pkg_resources._provider_factories[MockLoader] = MockProvider 
    56          
     57 
    5758        self.empty_egg = create_egg("egg_empty", {}) 
    5859        self.egg_1 = create_egg("egg_1", { 
     
    6263        self._old_installed_apps = settings.INSTALLED_APPS 
    6364        settings.INSTALLED_APPS = [] 
    64          
     65 
    6566    def tearDown(self): 
    6667        settings.INSTALLED_APPS = self._old_installed_apps 
     
    7576        settings.INSTALLED_APPS = ['egg_1'] 
    7677        self.assertRaises(TemplateDoesNotExist, lts_egg, "not-existing.html") 
    77      
     78 
    7879    def test_existing(self): 
    7980        "A template can be loaded from an egg" 
     
    8283        self.assertEqual(contents, "y") 
    8384        self.assertEqual(template_name, "egg:egg_1:templates/y.html") 
    84      
     85 
    8586    def test_not_installed(self): 
    8687        "Loading an existent template from an egg not included in INSTALLED_APPS should fail" 
     
    8889        self.assertRaises(TemplateDoesNotExist, lts_egg, "y.html") 
    8990 
    90      
    9191if __name__ == "__main__": 
    9292    unittest.main()