move sections
[python/dscho.git] / Lib / test / test_xml_etree_c.py
blob78a6a9241c9b97c50f8af7357975ec381bb3e99d
1 # xml.etree test for cElementTree
3 from test import test_support
5 cET = test_support.import_module('xml.etree.cElementTree')
8 # cElementTree specific tests
10 def sanity():
11 """
12 Import sanity.
14 >>> from xml.etree import cElementTree
15 """
18 def test_main():
19 from test import test_xml_etree, test_xml_etree_c
21 # Run the tests specific to the C implementation
22 test_support.run_doctest(test_xml_etree_c, verbosity=True)
24 # Assign the C implementation before running the doctests
25 # Patch the __name__, to prevent confusion with the pure Python test
26 pyET = test_xml_etree.ET
27 py__name__ = test_xml_etree.__name__
28 test_xml_etree.ET = cET
29 if __name__ != '__main__':
30 test_xml_etree.__name__ = __name__
31 try:
32 # Run the same test suite as xml.etree.ElementTree
33 test_xml_etree.test_main(module_name='xml.etree.cElementTree')
34 finally:
35 test_xml_etree.ET = pyET
36 test_xml_etree.__name__ = py__name__
38 if __name__ == '__main__':
39 test_main()