Add a couple minor tests for the CSS parser
This commit is contained in:
parent
7957dcd7c4
commit
fd82967bbc
1 changed files with 12 additions and 1 deletions
13
testcss.py
13
testcss.py
|
|
@ -29,9 +29,20 @@ class Blank(unittest.TestCase):
|
||||||
self.assertEquals( type(r), type([]), 'Blank string returned non list')
|
self.assertEquals( type(r), type([]), 'Blank string returned non list')
|
||||||
|
|
||||||
class ElementSelector(unittest.TestCase):
|
class ElementSelector(unittest.TestCase):
|
||||||
def runTest(self)
|
def runTest(self):
|
||||||
r = parseCssString('foo {}')
|
r = parseCssString('foo {}')
|
||||||
self.assertEquals( len(r), 1, 'Element selector not returned')
|
self.assertEquals( len(r), 1, 'Element selector not returned')
|
||||||
|
self.assertEquals( r[0]['selector'], 'foo', 'Selector for foo not returned')
|
||||||
|
self.assertEquals( len(r[0]['properties']), 0, 'Property list for foo not empty')
|
||||||
|
|
||||||
|
class ElementSelectorWithProperty(unittest.TestCase):
|
||||||
|
def runTest(self):
|
||||||
|
r = parseCssString('foo { bar: baz}')
|
||||||
|
print r
|
||||||
|
self.assertEquals( len(r), 1, 'Element selector not returned')
|
||||||
|
self.assertEquals( r[0]['selector'], 'foo', 'Selector for foo not returned')
|
||||||
|
self.assertEquals( len(r[0]['properties']), 1, 'Property list for foo did not have 1')
|
||||||
|
self.assertEquals( r[0]['properties']['bar'], 'baz', 'Property bar did not have baz value')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue