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  """
     3  __all__ = ['CSSutilsImportTestCase']
     4  __author__ = '$LastChangedBy: cthedot $'
     5  __date__ = '$LastChangedDate: 2007-09-26 17:00:37 +0200 (Mi, 26 Sep 2007) $'
     6  __version__ = '$LastChangedRevision: 468 $'
     7
     8  before = len(locals()) # to check is only exp amount is imported
     9  from cssutils import *
    10  after = len(locals()) # to check is only exp amount is imported
    11
    12  import unittest
    13
    14 -class CSSutilsImportTestCase(unittest.TestCase):
    15
    16 -    def test_import_all(self):
    17          "from cssutils import *"
    18          import cssutils
    19
    20          act = globals()
    21          exp = {'CSSParser': CSSParser,
    22                 'CSSSerializer': CSSSerializer,
    23                 'css': cssutils.css,
    24                 'stylesheets': cssutils.stylesheets,
    25          }
    26          exptotal = before + len(exp) + 1
    27          # imports before + * + "after"
    28          self.assert_(after == exptotal, 'too many imported')
    29
    30          found = 0
    31          for e in exp:
    32              self.assert_(e in act, '%s not found' %e)
    33              self.assert_(act[e] == exp[e], '%s not the same' %e)
    34              found += 1
    35          self.assert_(found == len(exp))
    36
    37  if __name__ == '__main__':
    38      import unittest
    39      unittest.main()
    40