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

# Source Code for Module cssutils.tests.test_domimplementation

     1  """Testcases for cssutils.css.DOMImplementation"""
     2  __version__ = '$Id: test_domimplementation.py 1116 2008-03-05 13:52:23Z cthedot $'
     3
     4  import xml.dom
     5  import unittest
     6  import cssutils
     7
     8 -class DOMImplementationTestCase(unittest.TestCase):
     9
    10 -    def setUp(self):
    11          self.domimpl = xml.dom.getDOMImplementation()
    12
    13 -    def test_createCSSStyleSheet(self):
    14          "DOMImplementationCSS.createCSSStyleSheet()"
    15          title, media = 'Test Title', cssutils.stylesheets.MediaList('all')
    16          sheet = self.domimpl.createCSSStyleSheet(title, media)
    17          self.assertEqual(True, isinstance(sheet, cssutils.css.CSSStyleSheet))
    18          self.assertEqual(title, sheet.title)
    19          self.assertEqual(media, sheet.media)
    20
    21 -    def test_createDocument(self):
    22          "DOMImplementationCSS.createDocument()"
    23          self.assertRaises(NotImplementedError, self.domimpl.createDocument)
    24          self.assertRaises(NotImplementedError, self.domimpl.createDocument)
    25
    26 -    def test_createDocumentType(self):
    27          "DOMImplementationCSS.createDocumentType()"
    28          self.assertRaises(NotImplementedError, self.domimpl.createDocumentType)
    29
    30 -    def test_hasFeature(self):
    31          "DOMImplementationCSS.hasFeature()"
    32          tests = [
    33              ('css', '1.0'),
    34              ('css', '2.0'),
    35              ('stylesheets', '1.0'),
    36              ('stylesheets', '2.0')
    37          ]
    38          for name, version in tests:
    39              self.assertEqual(True, self.domimpl.hasFeature(name, version))
    40
    41
    42  if __name__ == '__main__':
    43      unittest.main()
    44