/usr/share/pyshared/cssutils/tests/test_cssrulelist.py is in python-cssutils 0.9.10-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 | """Testcases for cssutils.css.CSSRuleList"""
import basetest
import cssutils
class CSSRuleListTestCase(basetest.BaseTestCase):
def test_init(self):
"CSSRuleList.__init__()"
r = cssutils.css.CSSRuleList()
self.assertEqual(0, r.length)
self.assertEqual(None, r.item(2))
# subclasses list but all setting options like append, extend etc
# need to be added to an instance of this class by a using class!
self.assertRaises(NotImplementedError, r.append, 1)
def test_rulesOfType(self):
"CSSRuleList.rulesOfType()"
s = cssutils.parseString('''
/*c*/
@namespace "a";
a { color: red}
b { left: 0 }''')
c = list(s.cssRules.rulesOfType(cssutils.css.CSSRule.COMMENT))
self.assertEqual(1, len(c))
self.assertEqual('/*c*/', c[0].cssText)
r = list(s.cssRules.rulesOfType(cssutils.css.CSSRule.STYLE_RULE))
self.assertEqual(2, len(r))
self.assertEqual('b {\n left: 0\n }', r[1].cssText)
if __name__ == '__main__':
import unittest
unittest.main()
|