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

Source Code for Module cssutils.tests.test_parse

 1  """ 
 2  tests for parsing which does not raise Exceptions normally 
 3  """ 
 4  __author__ = '$LastChangedBy: doerwalter $' 
 5  __date__ = '$LastChangedDate: 2007-08-02 22:58:23 +0200 (Do, 02 Aug 2007) $' 
 6  __version__ = '0.9.2a1, $LastChangedRevision: 160 $' 
 7   
 8  import xml.dom 
 9   
10  import basetest 
11   
12  import cssutils 
13   
14 -class CSSStyleSheetTestCase(basetest.BaseTestCase):
15
16 - def setUp(self):
17 # should be be disabled here?? 18 ##cssutils.log.raiseExceptions = False 19 pass
20 21
22 - def test_invalidstring(self):
23 "cssutils.parseString(INVALID_STRING)" 24 validfromhere = '@import "x";' 25 csss = ( 26 u'''@charset "ascii 27 ;''' + validfromhere, 28 u'''@charset 'ascii 29 ;''' + validfromhere, 30 u'''@import "x 31 ;''' + validfromhere, 32 u'''@unknown "x 33 ;''' + validfromhere) 34 for css in csss: 35 s = cssutils.parseString(css) 36 self.assertEqual(validfromhere, s.cssText) 37 38 css = u'''a { font-family: "Courier 39 ; }''' 40 s = cssutils.parseString(css) 41 self.assertEqual(u'a {}', s.cssText)
42 43
44 - def tearDown(self):
45 # needs to be reenabled here for other tests 46 cssutils.log.raiseExceptions = True
47 48 49 if __name__ == '__main__': 50 import unittest 51 unittest.main() 52