/usr/lib/python2.7/dist-packages/cssutils/tests/test_csscomment.py is in python-cssutils 1.0.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | # -*- coding: utf-8 -*-
"""Testcases for cssutils.css.CSSComment"""
import xml
import test_cssrule
import cssutils.css
class CSSCommentTestCase(test_cssrule.CSSRuleTestCase):
def setUp(self):
super(CSSCommentTestCase, self).setUp()
self.r = cssutils.css.CSSComment()
self.rRO = cssutils.css.CSSComment(readonly=True)
self.r_type = cssutils.css.CSSComment.COMMENT
self.r_typeString = 'COMMENT'
def test_init(self):
"CSSComment.type and init"
super(CSSCommentTestCase, self).test_init()
def test_csstext(self):
"CSSComment.cssText"
tests = {
u'/*öäü߀ÖÄÜ*/': u'/*\xf6\xe4\xfc\xdf\u20ac\xd6\xc4\xdc*/',
u'/*x*/': None,
u'/* x */': None,
u'/*\t12\n*/': None,
u'/* /* */': None,
u'/* \\*/': None,
u'/*"*/': None,
u'''/*"
*/''': None,
u'/** / ** //*/': None
}
self.do_equal_r(tests) # set cssText
tests.update({
u'/*x': u'/*x*/',
u'\n /*': u'/**/',
})
self.do_equal_p(tests) # parse
tests = {
u'/* */ ': xml.dom.InvalidModificationErr,
u'/* *//**/': xml.dom.InvalidModificationErr,
u'/* */1': xml.dom.InvalidModificationErr,
u'/* */ */': xml.dom.InvalidModificationErr,
u' */ /* ': xml.dom.InvalidModificationErr,
u'*/': xml.dom.InvalidModificationErr,
u'@x /* x */': xml.dom.InvalidModificationErr
}
self.do_raise_r(tests) # set cssText
# no raising of error possible?
# self.do_raise_p(tests) # parse
def test_InvalidModificationErr(self):
"CSSComment.cssText InvalidModificationErr"
self._test_InvalidModificationErr(u'/* comment */')
def test_reprANDstr(self):
"CSSComment.__repr__(), .__str__()"
text = '/* test */'
s = cssutils.css.CSSComment(cssText=text)
s2 = eval(repr(s))
self.assertTrue(isinstance(s2, s.__class__))
self.assertTrue(text == s2.cssText)
if __name__ == '__main__':
import unittest
unittest.main()
|