mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
fix the _namespace_map cleanup for cElementTree tests.
This commit is contained in:
parent
e59a306081
commit
1639505c38
2 changed files with 3 additions and 6 deletions
|
@ -1881,12 +1881,7 @@ class CleanContext(object):
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
from xml.etree import ElementPath
|
from xml.etree import ElementPath
|
||||||
if hasattr(ET, '_namespace_map'):
|
self._nsmap = ET.register_namespace._namespace_map
|
||||||
self._nsmap = ET._namespace_map
|
|
||||||
else:
|
|
||||||
# when testing the cElementTree alias
|
|
||||||
from xml.etree.ElementTree import _namespace_map
|
|
||||||
self._nsmap = _namespace_map
|
|
||||||
# Copy the default namespace mapping
|
# Copy the default namespace mapping
|
||||||
self._nsmap_copy = self._nsmap.copy()
|
self._nsmap_copy = self._nsmap.copy()
|
||||||
# Copy the path cache (should be empty)
|
# Copy the path cache (should be empty)
|
||||||
|
|
|
@ -1086,6 +1086,8 @@ _namespace_map = {
|
||||||
# dublin core
|
# dublin core
|
||||||
"http://purl.org/dc/elements/1.1/": "dc",
|
"http://purl.org/dc/elements/1.1/": "dc",
|
||||||
}
|
}
|
||||||
|
# For tests and troubleshooting
|
||||||
|
register_namespace._namespace_map = _namespace_map
|
||||||
|
|
||||||
def _raise_serialization_error(text):
|
def _raise_serialization_error(text):
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue