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

# Source Code for Module cssutils.tests.test_domimplementation

     1  """
     2  testcases for cssutils.css.DOMImplementation
     3  """
     4  __author__ = '$LastChangedBy: doerwalter $'
     5  __date__ = '$LastChangedDate: 2007-08-02 22:58:23 +0200 (Do, 02 Aug 2007) $'
     6  __version__ = '$LastChangedRevision: 160 $'
     7
     8  import xml.dom
     9  import unittest
    10  import cssutils
    11
    12 -class DOMImplementationTestCase(unittest.TestCase):
    13
    14 -    def setUp(self):
    15          self.domimpl = xml.dom.getDOMImplementation()
    16
    17 -    def test_createCSSStyleSheet(self):
    18          "DOMImplementationCSS.createCSSStyleSheet()"
    19          title, media = 'Test Title', cssutils.stylesheets.MediaList('all')
    20          sheet = self.domimpl.createCSSStyleSheet(title, media)
    21          self.assertEqual(True, isinstance(sheet, cssutils.css.CSSStyleSheet))
    22          self.assertEqual(title, sheet.title)
    23          self.assertEqual(media, sheet.media)
    24
    25 -    def test_createDocument(self):
    26          "DOMImplementationCSS.createDocument()"
    27          self.assertRaises(NotImplementedError, self.domimpl.createDocument)
    28          self.assertRaises(NotImplementedError, self.domimpl.createDocument)
    29
    30 -    def test_createDocumentType(self):
    31          "DOMImplementationCSS.createDocumentType()"
    32          self.assertRaises(NotImplementedError, self.domimpl.createDocumentType)
    33
    34 -    def test_hasFeature(self):
    35          "DOMImplementationCSS.hasFeature()"
    36          tests = [
    37              ('css', '1.0'),
    38              ('css', '2.0'),
    39              ('stylesheets', '1.0'),
    40              ('stylesheets', '2.0')
    41          ]
    42          for name, version in tests:
    43              self.assertEqual(True, self.domimpl.hasFeature(name, version))
    44
    45
    46  if __name__ == '__main__':
    47      unittest.main()
    48