1
2 import unittest, doctest
3
4
5
6
7
8
9 import sys, gc, os.path
10 from lxml import etree
11
12 this_dir = os.path.dirname(__file__)
13 if this_dir not in sys.path:
14 sys.path.insert(0, this_dir)
15
16 from common_imports import HelperTestCase
17
19 etree = etree
20
22
23
24 self.assertRaises(TypeError, self.etree.Element, 'a', 'b')
25
28
30
31 Element = self.etree.Element
32 gc.collect()
33
34 count = sys.getrefcount(None)
35
36 l = [Element('name'), Element('name')]
37 l.append(l)
38
39 del l
40 gc.collect()
41
42 self.assertEqual(sys.getrefcount(None), count)
43
45 suite = unittest.TestSuite()
46 suite.addTests([unittest.makeSuite(ErrorTestCase)])
47 return suite
48
49 if __name__ == '__main__':
50 print('to test use test.py %s' % __file__)
51