14
0
2020-11-10 07:46:31 +00:00
committed by Git OBS Bridge
parent 80adc55baf
commit e6a9564705

View File

@@ -1,5 +1,3 @@
diff --git a/tests/test_documents.py b/tests/test_documents.py
index 6c616fe..bd5d8c5 100644
--- a/tests/test_documents.py
+++ b/tests/test_documents.py
@@ -16,7 +16,6 @@ import io
@@ -10,7 +8,7 @@ index 6c616fe..bd5d8c5 100644
try:
import lxml.etree as lxml_etree
@@ -27,7 +26,7 @@ from xmlschema import XMLSchema10, XMLSchema11, XmlDocument, \
@@ -27,7 +26,7 @@ from xmlschema import XMLSchema10, XMLSc
XMLResourceError, XMLSchemaValidationError, XMLSchemaDecodeError, \
to_json, from_json
@@ -19,8 +17,6 @@ index 6c616fe..bd5d8c5 100644
from xmlschema.namespaces import XSD_NAMESPACE, XSI_NAMESPACE
from xmlschema.resources import XMLResource
from xmlschema.documents import get_context
diff --git a/tests/test_etree.py b/tests/test_etree.py
index d16c793..96aba4b 100644
--- a/tests/test_etree.py
+++ b/tests/test_etree.py
@@ -11,10 +11,11 @@
@@ -289,7 +285,7 @@ index d16c793..96aba4b 100644
(root, '/'), (root[0], '/b1'), (root[0][0], '/b1/c1'),
(root[0][1], '/b1/c2'), (root[1], '/b2'), (root[2], '/b3'),
(root[2][0], '/b3/c3')
@@ -203,104 +201,104 @@ class TestElementTree(unittest.TestCase):
@@ -203,104 +201,104 @@ class TestElementTree(unittest.TestCase)
def test_etree_getpath(self):
root = ElementTree.XML('<a><b1><c1/><c2/></b1><b2/><b3><c3/></b3></a>')
@@ -298,15 +294,16 @@ index d16c793..96aba4b 100644
- self.assertEqual(etree.etree_getpath(root[2][0], root), './b3/c3')
- self.assertEqual(etree.etree_getpath(root[0], root, parent_path=True), '.')
- self.assertEqual(etree.etree_getpath(root[2][0], root, parent_path=True), './b3')
-
- self.assertIsNone(etree.etree_getpath(root, root[0]))
- self.assertIsNone(etree.etree_getpath(root[0], root[1]))
- self.assertIsNone(etree.etree_getpath(root, root, parent_path=True))
+ self.assertEqual(etree_getpath(root, root), '.')
+ self.assertEqual(etree_getpath(root[0], root), './b1')
+ self.assertEqual(etree_getpath(root[2][0], root), './b3/c3')
+ self.assertEqual(etree_getpath(root[0], root, parent_path=True), '.')
+ self.assertEqual(etree_getpath(root[2][0], root, parent_path=True), './b3')
- self.assertIsNone(etree.etree_getpath(root, root[0]))
- self.assertIsNone(etree.etree_getpath(root[0], root[1]))
- self.assertIsNone(etree.etree_getpath(root, root, parent_path=True))
+
+ self.assertIsNone(etree_getpath(root, root[0]))
+ self.assertIsNone(etree_getpath(root[0], root[1]))
+ self.assertIsNone(etree_getpath(root, root, parent_path=True))
@@ -427,7 +424,7 @@ index d16c793..96aba4b 100644
self.assertIn("tails differ: None != 'tail'", str(ctx.exception))
def test_iter_location_hints(self):
@@ -309,7 +307,7 @@ class TestElementTree(unittest.TestCase):
@@ -309,7 +307,7 @@ class TestElementTree(unittest.TestCase)
xsi:schemaLocation="http://example.com/xmlschema/ns-A import-case4a.xsd"/>"""
)
self.assertListEqual(
@@ -436,7 +433,7 @@ index d16c793..96aba4b 100644
[('http://example.com/xmlschema/ns-A', 'import-case4a.xsd')]
)
elem = ElementTree.XML(
@@ -317,16 +315,16 @@ class TestElementTree(unittest.TestCase):
@@ -317,16 +315,16 @@ class TestElementTree(unittest.TestCase)
xsi:noNamespaceSchemaLocation="schema.xsd"/>"""
)
self.assertListEqual(
@@ -456,8 +453,6 @@ index d16c793..96aba4b 100644
self.assertListEqual([e.tag for e in root.iter()], ['a', 'b1', 'b2', 'b3'])
diff --git a/tests/test_helpers.py b/tests/test_helpers.py
index a7148ca..29b93ff 100644
--- a/tests/test_helpers.py
+++ b/tests/test_helpers.py
@@ -12,11 +12,10 @@
@@ -473,11 +468,9 @@ index a7148ca..29b93ff 100644
from xmlschema.qnames import XSD_SCHEMA, XSD_ELEMENT, XSD_SIMPLE_TYPE, XSD_ANNOTATION
from xmlschema.helpers import get_xsd_annotation, get_xsd_derivation_attribute, \
get_xsd_form_attribute, raw_xml_encode, count_digits, strictly_equal, \
diff --git a/tests/test_resources.py b/tests/test_resources.py
index 8fd2073..546bbdb 100644
--- a/tests/test_resources.py
+++ b/tests/test_resources.py
@@ -19,7 +19,6 @@ from urllib.error import URLError
@@ -19,19 +19,22 @@ from urllib.error import URLError
from urllib.request import urlopen
from urllib.parse import urlsplit, uses_relative
from pathlib import Path, PureWindowsPath, PurePath
@@ -485,20 +478,39 @@ index 8fd2073..546bbdb 100644
try:
import lxml.etree as lxml_etree
@@ -28,7 +27,7 @@ except ImportError:
except ImportError:
lxml_etree = None
from xmlschema import fetch_namespaces, fetch_resource, normalize_url, \
fetch_schema, fetch_schema_locations, XMLResource, XMLResourceError, XMLSchema
-from xmlschema import fetch_namespaces, fetch_resource, normalize_url, \
- fetch_schema, fetch_schema_locations, XMLResource, XMLResourceError, XMLSchema
-from xmlschema.etree import etree_element, py_etree_element, is_etree_element
+from xmlschema.etree import ElementTree, etree_element, py_etree_element, is_etree_element
+from xmlschema import XMLResource, XMLSchema
+from xmlschema.etree import (ElementTree, etree_element,
+ py_etree_element, is_etree_element)
from xmlschema.namespaces import XSD_NAMESPACE
from xmlschema.resources import is_url, is_local_url, is_remote_url, \
url_path_is_file, normalize_locations, LazySelector
diff --git a/tests/test_w3c_suite.py b/tests/test_w3c_suite.py
index 6df61d2..964ce08 100644
-from xmlschema.resources import is_url, is_local_url, is_remote_url, \
- url_path_is_file, normalize_locations, LazySelector
+from xmlschema.exceptions import XMLResourceError
+from xmlschema.resources import (fetch_namespaces, fetch_resource,
+ fetch_schema, fetch_schema_locations,
+ is_url, is_local_url, is_remote_url,
+ url_path_is_file, normalize_locations,
+ normalize_url, LazySelector)
from xmlschema.testing import SKIP_REMOTE_TESTS
@@ -1076,7 +1079,7 @@ class TestResources(unittest.TestCase):
self.assertTrue(isinstance(vh_schema, XMLSchema))
xsd_source = """
- <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:vh="http://example.com/vehicles">
<xs:import namespace="http://example.com/vehicles" schemaLocation="{}"/>
</xs:schema>""".format(self.vh_xsd_file)
--- a/tests/test_w3c_suite.py
+++ b/tests/test_w3c_suite.py
@@ -14,7 +14,6 @@ This script runs tests concerning the W3C XML Schema 1.1 test suite.
@@ -14,7 +14,6 @@ This script runs tests concerning the W3
import unittest
import argparse
import os.path
@@ -514,8 +526,6 @@ index 6df61d2..964ce08 100644
TEST_SUITE_NAMESPACE = "http://www.w3.org/XML/2004/xml-schema-test-suite/"
XLINK_NAMESPACE = "http://www.w3.org/1999/xlink"
diff --git a/tests/test_wsdl.py b/tests/test_wsdl.py
index c480156..65a5209 100644
--- a/tests/test_wsdl.py
+++ b/tests/test_wsdl.py
@@ -14,13 +14,11 @@ import unittest
@@ -533,8 +543,42 @@ index c480156..65a5209 100644
TEST_CASES_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'test_cases/')
diff --git a/tests/test_xpath.py b/tests/test_xpath.py
index e72b221..eb5acad 100644
@@ -97,7 +95,7 @@ WSDL_DOCUMENT_EXAMPLE = """<?xml version
WSDL_DOCUMENT_NO_SOAP = """<?xml version="1.0"?>
<wsdl:definitions name="minimal"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<wsdl:message name="myMessage">
@@ -403,7 +401,7 @@ class TestWsdlDocuments(unittest.TestCas
def test_wsdl_document_invalid_imports(self):
wsdl_template = """<?xml version="1.0"?>
- <definitions name="import-test1"
+ <definitions name="import-test1"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<import namespace="http://example.com/ns" location="{0}"/>
</definitions>"""
@@ -427,7 +425,7 @@ class TestWsdlDocuments(unittest.TestCas
self.assertIn('no element found', str(ctx.exception))
wsdl_template = """<?xml version="1.0"?>
- <definitions name="import-test1"
+ <definitions name="import-test1"
targetNamespace="http://example.com/ns"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<import namespace="http://example.com/ns" location="{0}"/>
@@ -439,7 +437,7 @@ class TestWsdlDocuments(unittest.TestCas
self.assertIn('namespace to import must be different', str(ctx.exception))
wsdl_template = """<?xml version="1.0"?>
- <definitions name="import-test1"
+ <definitions name="import-test1"
targetNamespace="http://example.com/stockquote/definitions"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<import namespace="http://example.com/ns" location="{0}"/>
--- a/tests/test_xpath.py
+++ b/tests/test_xpath.py
@@ -12,12 +12,12 @@
@@ -551,8 +595,6 @@ index e72b221..eb5acad 100644
from xmlschema.xpath import XMLSchemaProxy, iter_schema_nodes
from xmlschema.validators import XsdAtomic, XsdAtomicRestriction
diff --git a/tests/validation/test_decoding.py b/tests/validation/test_decoding.py
index 908e6bd..ae7742a 100644
--- a/tests/validation/test_decoding.py
+++ b/tests/validation/test_decoding.py
@@ -12,7 +12,6 @@ import unittest
@@ -571,8 +613,6 @@ index 908e6bd..ae7742a 100644
from xmlschema.converters import UnorderedConverter
from xmlschema.validators import XMLSchema11
from xmlschema.testing import XsdValidatorTestCase
diff --git a/tests/validation/test_validation.py b/tests/validation/test_validation.py
index be8ce36..b104973 100644
--- a/tests/validation/test_validation.py
+++ b/tests/validation/test_validation.py
@@ -11,7 +11,6 @@
@@ -591,8 +631,6 @@ index be8ce36..b104973 100644
from xmlschema.validators import XMLSchema11
from xmlschema.testing import XsdValidatorTestCase
diff --git a/tests/validators/test_exceptions.py b/tests/validators/test_exceptions.py
index c23f1d6..86c5635 100644
--- a/tests/validators/test_exceptions.py
+++ b/tests/validators/test_exceptions.py
@@ -11,10 +11,10 @@
@@ -607,8 +645,6 @@ index c23f1d6..86c5635 100644
from xmlschema.validators.exceptions import XMLSchemaValidatorError, \
XMLSchemaNotBuiltError, XMLSchemaModelDepthError, XMLSchemaValidationError, \
XMLSchemaChildrenValidationError
diff --git a/tests/validators/test_notations.py b/tests/validators/test_notations.py
index 0b48c01..a14baa8 100644
--- a/tests/validators/test_notations.py
+++ b/tests/validators/test_notations.py
@@ -9,9 +9,9 @@
@@ -622,8 +658,6 @@ index 0b48c01..a14baa8 100644
from xmlschema.qnames import XSD_NOTATION
from xmlschema.validators import XMLSchema10, XMLSchema11, XsdNotation
diff --git a/tests/validators/test_xsdbase.py b/tests/validators/test_xsdbase.py
index f5791b4..6182a83 100644
--- a/tests/validators/test_xsdbase.py
+++ b/tests/validators/test_xsdbase.py
@@ -12,10 +12,10 @@ import unittest
@@ -638,7 +672,7 @@ index f5791b4..6182a83 100644
from xmlschema.qnames import XSD_ELEMENT, XSD_ANNOTATION, XSD_ANY_TYPE
from xmlschema.namespaces import XSD_NAMESPACE
@@ -766,7 +766,6 @@ class TestParticleMixin(unittest.TestCase):
@@ -766,7 +766,6 @@ class TestParticleMixin(unittest.TestCas
if __name__ == '__main__':