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

# Source Code for Module cssutils.tests.test_cssutilsimport

     1  """
     2  testcases for cssutils.css.CSSCharsetRule
     3  """
     4  __all__ = ['CSSutilsImportTestCase']
     5  __author__ = '$LastChangedBy: doerwalter $'
     6  __date__ = '$LastChangedDate: 2007-08-02 22:58:23 +0200 (Do, 02 Aug 2007) $'
     7  __version__ = '0.9.2a1, $LastChangedRevision: 160 $'
     8
     9  before = len(locals()) # to check is only exp amount is imported
    10  from cssutils import *
    11  after = len(locals()) # to check is only exp amount is imported
    12
    13  import unittest
    14
    15
    16 -class CSSutilsImportTestCase(unittest.TestCase):
    17
    18 -    def test_import_all(self):
    19          "from cssutils import *"
    20          import cssutils
    21
    22          act = globals()
    23          exp = {
    24              'CSSParser': CSSParser,
    25              'CSSSerializer': CSSSerializer,
    26              'css': cssutils.css,
    27              'stylesheets': cssutils.stylesheets,
    28          }
    29          exptotal = before + len(exp) + 1
    30          # imports before + * + "after"
    31          self.assert_(after == exptotal, 'too many imported')
    32
    33          found = 0
    34          for e in exp:
    35              self.assert_(e in act, '%s not found' %e)
    36              self.assert_(act[e] == exp[e], '%s not the same' %e)
    37              found += 1
    38          self.assert_(found == len(exp))
    39
    40
    41  if __name__ == '__main__':
    42      import unittest
    43      unittest.main()
    44