~doctormo/+junk/css-parser

« back to all changes in this revision

Viewing changes to tests/test_simple.py

  • Committer: Martin Owens
  • Date: 2014-07-13 21:48:23 UTC
  • Revision ID: doctormo@gmail.com-20140713214823-774n9vbbhw93zlbh
Move the files around and add some simple events

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
sys.path.insert(0, '.')
23
23
 
24
24
import unittest
25
 
from css import CssParser
26
 
from property import PropertyObject
 
25
from csslavie import CssParser, PropertyObject
27
26
try:
28
27
    from test import test_support
29
28
except ImportError:
33
32
class Name(PropertyObject):
34
33
    value = 0
35
34
 
36
 
    def __init__(self, name=None, classes=None):
 
35
    def __init__(self, *args, **kwargs):
37
36
        self.sticky = 2
38
 
        if name:
39
 
            self.name = name
40
 
        if classes:
41
 
            self.classes = classes
 
37
        PropertyObject.__init__(self, *args, **kwargs)
42
38
 
43
39
 
44
40
class SimpleTestCase(unittest.TestCase):
60
56
        self.css.attach(named)
61
57
        self.assertEqual(named.sticky, 2)
62
58
        del named.sticky
63
 
        self.assertEqual(named.sticky, 4)
 
59
        self.assertEqual(named.sticky, -1)
64
60
 
65
61
    def test_03_id(self):
66
62
        """Attach by Id / Object Name"""
84
80
        self.assertEqual(named.value, 4)
85
81
 
86
82
 
 
83
 
 
84
 
87
85
if __name__ == '__main__':
88
86
    test_support.run_unittest(
89
87
       SimpleTestCase,