Statistics
| Revision:

gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.app / org.gvsig.scripting.app.mainplugin / src / main / resources-plugin / scripting / lib / cssutils / tests / test_cssutilsimport.py @ 475

History | View | Annotate | Download (998 Bytes)

1
"""Testcase for cssutils imports"""
2

    
3
before = len(locals()) # to check is only exp amount is imported
4
from cssutils import *
5
after = len(locals()) # to check is only exp amount is imported
6

    
7
import unittest
8

    
9
class CSSutilsImportTestCase(unittest.TestCase):
10

    
11
    def test_import_all(self):
12
        "from cssutils import *"
13
        import cssutils
14

    
15
        act = globals()
16
        exp = {'CSSParser': CSSParser,
17
               'CSSSerializer': CSSSerializer,
18
               'css': cssutils.css,
19
               'stylesheets': cssutils.stylesheets,
20
        }
21
        exptotal = before + len(exp) + 1
22
        # imports before + * + "after"
23
        self.assertTrue(after == exptotal, 'too many imported')
24

    
25
        found = 0
26
        for e in exp:
27
            self.assertTrue(e in act, '%s not found' %e)
28
            self.assertTrue(act[e] == exp[e], '%s not the same' %e)
29
            found += 1
30
        self.assertTrue(found == len(exp))
31

    
32
if __name__ == '__main__':
33
    import unittest
34
    unittest.main()