Back to index

python3.2  3.2.2
Classes | Functions | Variables
test.test_xml_etree_c Namespace Reference

Classes

class  MiscTests

Functions

def sanity
def test_main

Variables

tuple cET = support.import_module('xml.etree.cElementTree')

Function Documentation

Definition at line 12 of file test_xml_etree_c.py.

00012 
00013 def sanity():
00014     r"""
00015     Import sanity.
00016 
00017     >>> from xml.etree import cElementTree
00018 
00019     Issue #6697.
00020 
00021     >>> e = cElementTree.Element('a')
00022     >>> getattr(e, '\uD800')           # doctest: +ELLIPSIS
00023     Traceback (most recent call last):
00024       ...
00025     UnicodeEncodeError: ...
00026 
00027     >>> p = cElementTree.XMLParser()
00028     >>> p.version.split()[0]
00029     'Expat'
00030     >>> getattr(p, '\uD800')
00031     Traceback (most recent call last):
00032      ...
00033     AttributeError: 'XMLParser' object has no attribute '\ud800'
00034     """
00035 

Definition at line 50 of file test_xml_etree_c.py.

00050 
00051 def test_main():
00052     from test import test_xml_etree, test_xml_etree_c
00053 
00054     # Run the tests specific to the C implementation
00055     support.run_doctest(test_xml_etree_c, verbosity=True)
00056 
00057     support.run_unittest(MiscTests)
00058 
00059     # Assign the C implementation before running the doctests
00060     # Patch the __name__, to prevent confusion with the pure Python test
00061     pyET = test_xml_etree.ET
00062     py__name__ = test_xml_etree.__name__
00063     test_xml_etree.ET = cET
00064     if __name__ != '__main__':
00065         test_xml_etree.__name__ = __name__
00066     try:
00067         # Run the same test suite as xml.etree.ElementTree
00068         test_xml_etree.test_main(module_name='xml.etree.cElementTree')
00069     finally:
00070         test_xml_etree.ET = pyET
00071         test_xml_etree.__name__ = py__name__


Variable Documentation

tuple test.test_xml_etree_c.cET = support.import_module('xml.etree.cElementTree')

Definition at line 7 of file test_xml_etree_c.py.