summaryrefslogtreecommitdiff
path: root/tests/test_loader.py
blob: 42222ac6850234c5c150baee1bfdb37cb745aa6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import unittest
import pystache

class TestLoader(unittest.TestCase):
    
    def test_template_is_loaded(self):
        loader = pystache.Loader()
        template = loader.load_template('simple', 'examples')
        
        self.assertEqual(template, 'Hi {{thing}}!{{blank}}')
        
    def test_using_list_of_paths(self):
        loader = pystache.Loader()
        template = loader.load_template('simple', ['doesnt_exist', 'examples'])
        
        self.assertEqual(template, 'Hi {{thing}}!{{blank}}')
        
    def test_non_existent_template_fails(self):
        loader = pystache.Loader()
        
        self.assertRaises(IOError, loader.load_template, 'simple', 'doesnt_exist')