| 1 | import unittest |
| 2 | |
| 3 | from Cheetah import DirectiveAnalyzer |
| 4 | |
| 5 | |
| 6 | class AnalyzerTests(unittest.TestCase): |
| 7 | def test_set(self): |
| 8 | template = ''' |
| 9 | #set $foo = "bar" |
| 10 | Hello ${foo}! |
| 11 | ''' |
| 12 | calls = DirectiveAnalyzer.analyze(template) |
| 13 | self.assertEqual(1, calls.get('set')) |
| 14 | |
| 15 | def test_compilersettings(self): |
| 16 | template = ''' |
| 17 | #compiler-settings |
| 18 | useNameMapper = False |
| 19 | #end compiler-settings |
| 20 | ''' |
| 21 | calls = DirectiveAnalyzer.analyze(template) |
| 22 | self.assertEqual(1, calls.get('compiler-settings')) |