Package cssutils :: Package tests :: Module test_cssutilsimport
[hide private]
[frames] | no frames]

Source Code for Module cssutils.tests.test_cssutilsimport

 1  """Testcase for cssutils imports""" 
 2  __version__ = '$Id: test_cssutilsimport.py 1116 2008-03-05 13:52:23Z cthedot $' 
 3   
 4  before = len(locals()) # to check is only exp amount is imported 
 5  from cssutils import * 
 6  after = len(locals()) # to check is only exp amount is imported 
 7   
 8  import unittest 
 9   
10 -class CSSutilsImportTestCase(unittest.TestCase):
11
12 - def test_import_all(self):
13 "from cssutils import *" 14 import cssutils 15 16 act = globals() 17 exp = {'CSSParser': CSSParser, 18 'CSSSerializer': CSSSerializer, 19 'css': cssutils.css, 20 'stylesheets': cssutils.stylesheets, 21 } 22 exptotal = before + len(exp) + 1 23 # imports before + * + "after" 24 self.assert_(after == exptotal, 'too many imported') 25 26 found = 0 27 for e in exp: 28 self.assert_(e in act, '%s not found' %e) 29 self.assert_(act[e] == exp[e], '%s not the same' %e) 30 found += 1 31 self.assert_(found == len(exp))
32 33 if __name__ == '__main__': 34 import unittest 35 unittest.main() 36