Add rule and stylesheet tests.
Fix Python 2.x support